@@ -407,11 +407,13 @@ func TestOptionalString(t *testing.T) {
407
407
t .Fatal ("should be the default" )
408
408
}
409
409
if val := defaultOptionalString .WithDefault ("" ); val != "" {
410
- t .Errorf ("optional integer should have been empty, got %s" , val )
410
+ t .Errorf ("optional string should have been empty, got %s" , val )
411
+ }
412
+ if val := defaultOptionalString .String (); val != "" {
413
+ t .Fatalf ("default optional string should be an empty string, got %s" , val )
411
414
}
412
-
413
415
if val := defaultOptionalString .WithDefault ("foo" ); val != "foo" {
414
- t .Errorf ("optional integer should have been foo, got %s" , val )
416
+ t .Errorf ("optional string should have been foo, got %s" , val )
415
417
}
416
418
417
419
var filledStr OptionalString
@@ -420,12 +422,14 @@ func TestOptionalString(t *testing.T) {
420
422
t .Fatal ("should not be the default" )
421
423
}
422
424
if val := filledStr .WithDefault ("bar" ); val != "foo" {
423
- t .Errorf ("optional integer should have been foo, got %s" , val )
425
+ t .Errorf ("optional string should have been foo, got %s" , val )
426
+ }
427
+ if val := filledStr .String (); val != "foo" {
428
+ t .Fatalf ("optional string should have been foo, got %s" , val )
424
429
}
425
-
426
430
filledStr = OptionalString {value : makeStringPointer ("" )}
427
431
if val := filledStr .WithDefault ("foo" ); val != "" {
428
- t .Errorf ("optional integer should have been 0, got %s" , val )
432
+ t .Errorf ("optional string should have been 0, got %s" , val )
429
433
}
430
434
431
435
for jsonStr , goValue := range map [string ]OptionalString {
0 commit comments