mirror of
https://github.com/golang/go
synced 2024-11-26 06:07:57 -07:00
treat "" as empty
R=r DELTA=10 (10 added, 0 deleted, 0 changed) OCL=27479 CL=27481
This commit is contained in:
parent
816f5b3124
commit
19692beee8
@ -308,6 +308,8 @@ func empty(v reflect.Value, indirect_ok bool) bool {
|
||||
return true
|
||||
}
|
||||
switch v.Type().Kind() {
|
||||
case reflect.StringKind:
|
||||
return v.(reflect.StringValue).Get() == "";
|
||||
case reflect.StructKind:
|
||||
return false;
|
||||
case reflect.ArrayKind:
|
||||
|
@ -29,6 +29,7 @@ type S struct {
|
||||
data []T;
|
||||
pdata []*T;
|
||||
empty []*T;
|
||||
emptystring string;
|
||||
null []*T;
|
||||
}
|
||||
|
||||
@ -170,6 +171,13 @@ var tests = []*Test {
|
||||
"&<>!@ #$%^\n"
|
||||
"&<>!@ #$%^\n"
|
||||
},
|
||||
|
||||
&Test{
|
||||
"{.section emptystring}emptystring{.end}\n"
|
||||
"{.section header}header{.end}\n",
|
||||
|
||||
"\nheader\n"
|
||||
},
|
||||
}
|
||||
|
||||
func TestAll(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user