t_parser_test.go: Expr's type names

This commit is contained in:
Celestino Amoroso 2024-06-05 05:06:43 +02:00
parent e4ded4f746
commit 9e63e1402e

View File

@ -201,7 +201,7 @@ func doTest(t *testing.T, section string, input *inputType, count int) (good boo
eq := reflect.DeepEqual(gotResult, input.wantResult)
if !eq /*gotResult != input.wantResult*/ {
t.Errorf("%d: %q -> result = %v [%T], want = %v [%T]", count, input.source, gotResult, gotResult, input.wantResult, input.wantResult)
t.Errorf("%d: %q -> result = %v [%s], want = %v [%s]", count, input.source, gotResult, typeName(gotResult), input.wantResult, typeName(input.wantResult))
good = false
}
@ -214,6 +214,21 @@ func doTest(t *testing.T, section string, input *inputType, count int) (good boo
return
}
/*
func typeName(v any) (s string) {
if v != nil {
if typer,ok:=v.(Typer);ok {
s = typer.TypeName()
}else{
s=fmt.Sprintf("%T", v)
}
} else {
s = "nil"
}
return
}
*/
func logTest(t *testing.T, n int, section, source string, wantResult any, wantErr error) {
if wantErr == nil {
t.Logf("[+]%s nr %3d -- %q --> %v", section, n, source, wantResult)