@@ -152,6 +152,35 @@ func TestBlankAndWhitespaceValues(t *testing.T) {
152152 }
153153}
154154
155+ func TestIssue96EmptyStringShortFlagValue (t * testing.T ) {
156+ // Issue 96: ./app -log.file.dir "" -log.logstash.level INFO
157+ // Expect: no parse error, log.file.dir stored as "", log.logstash.level stored as "INFO".
158+ t .Parallel ()
159+
160+ // Setup parser mirroring the issue-96 configuration with dotted short flag names.
161+ p := NewParser ("app" )
162+
163+ var fileDir string
164+ var logstashLevel string
165+
166+ // Register both flags using the same short/long names as the regression report.
167+ p .String (& fileDir , "log.file.dir" , "logFileDir" , "Directory for log files (issue 96)" )
168+ p .String (& logstashLevel , "log.logstash.level" , "logLogstashLevel" , "Logstash level (issue 96)" )
169+
170+ // Parse the exact CLI from the GitHub issue to guard against regression.
171+ args := []string {"-log.file.dir" , "" , "-log.logstash.level" , "INFO" }
172+ if err := p .ParseArgs (args ); err != nil {
173+ t .Fatalf ("parse failed for issue 96 reproduction: %v" , err )
174+ }
175+
176+ if fileDir != "" {
177+ t .Fatalf ("expected log.file.dir to remain an empty string, got %q" , fileDir )
178+ }
179+ if logstashLevel != "INFO" {
180+ t .Fatalf ("expected log.logstash.level to be \" INFO\" , got %q" , logstashLevel )
181+ }
182+ }
183+
155184func TestRootBoolAfterSubcommand (t * testing.T ) {
156185 // Command: ./app subcommandA --output
157186 // Expect: subcommandA used; root --output bool flag set to true.
0 commit comments