From 73ba344da8bb10b5838cd6e6ece993ad47bf97cc Mon Sep 17 00:00:00 2001 From: John Kerl Date: Sun, 29 Nov 2020 22:21:26 -0500 Subject: [PATCH] have typeof produce "string" not "str" (as in C impl) --- go/cases-to-do.txt | 8 ---- .../expected/case-dsl-type-reflect.sh.out | 38 +++++++++---------- go/src/miller/types/mlrval.go | 2 +- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/go/cases-to-do.txt b/go/cases-to-do.txt index 437b6a6f0..4adf6fef4 100644 --- a/go/cases-to-do.txt +++ b/go/cases-to-do.txt @@ -4,9 +4,6 @@ BUG: rrv ./reg-test/cases/case-c-dsl-mapvar-assignments.sh * probably buggy in the C impl -rrv ./reg-test/cases/case-c-dsl-split-join.sh -* splitnv narg 2 vs 3 ?!? - rrv ./reg-test/cases/case-c-dsl-forbind-typedecl.sh rrv ./reg-test/cases/case-c-dsl-localvar-typedecl.sh rrv ./reg-test/cases/case-c-dsl-local-map-variable-typedecl.sh @@ -17,11 +14,6 @@ rrv ./reg-test/cases/case-c-dsl-triple-for-loops.sh * Needs to do this: "Continuation statements are split into the final boolean, and the statements before (if any)." -================================================================ -MULTIPLE ISSUES: - -* typeof prints different things -- regularize ... - ================================================================ LF/CRLF ETC. diff --git a/go/reg-test/expected/case-dsl-type-reflect.sh.out b/go/reg-test/expected/case-dsl-type-reflect.sh.out index 4a8d46261..5ccc50029 100644 --- a/go/reg-test/expected/case-dsl-type-reflect.sh.out +++ b/go/reg-test/expected/case-dsl-type-reflect.sh.out @@ -6,20 +6,20 @@ mlr --j2p --from ./reg-test/input/typecast.json put $float = float($a); $boolean = boolean($a); then reorder -f t,a -t a string int float boolean -str abc abc (error) (error) (error) -int 0 0 0 0 false -int 2 2 2 2 true -float 0.0 0.0 0 0.0 false -float 2.3 2.3 2 2.3 true -bool false false 0 0 false -bool true true 1 1 true -str 0 0 0 0 (error) -str 2 2 2 2 (error) -str 0.0 0.0 (error) 0 (error) -str 2.3 2.3 (error) 2.3 (error) -str false false (error) (error) false -str true true (error) (error) true +t a string int float boolean +string abc abc (error) (error) (error) +int 0 0 0 0 false +int 2 2 2 2 true +float 0.0 0.0 0 0.0 false +float 2.3 2.3 2 2.3 true +bool false false 0 0 false +bool true true 1 1 true +string 0 0 0 0 (error) +string 2 2 2 2 (error) +string 0.0 0.0 (error) 0 (error) +string 2.3 2.3 (error) 2.3 (error) +string false false (error) (error) false +string true true (error) (error) true mlr --idkvp --opprint --from ./reg-test/input/s.dkvp put for (k, v in $*) { @@ -27,11 +27,11 @@ mlr --idkvp --opprint --from ./reg-test/input/s.dkvp put } $tnonesuch = typeof($nonesuch) -a b i x y ta tb ti tx ty tnonesuch -pan pan 1 0.3467901443380824 0.7268028627434533 str str int float float absent -eks pan 2 0.7586799647899636 0.5221511083334797 str str int float float absent -wye wye 3 0.20460330576630303 0.33831852551664776 str str int float float absent -eks wye 4 0.38139939387114097 0.13418874328430463 str str int float float absent +a b i x y ta tb ti tx ty tnonesuch +pan pan 1 0.3467901443380824 0.7268028627434533 string string int float float absent +eks pan 2 0.7586799647899636 0.5221511083334797 string string int float float absent +wye wye 3 0.20460330576630303 0.33831852551664776 string string int float float absent +eks wye 4 0.38139939387114097 0.13418874328430463 string string int float float absent mlr --idkvp --opprint --from ./reg-test/input/s.dkvp put for (k, v in $*) { diff --git a/go/src/miller/types/mlrval.go b/go/src/miller/types/mlrval.go index d896a28cf..6c19f8623 100644 --- a/go/src/miller/types/mlrval.go +++ b/go/src/miller/types/mlrval.go @@ -100,7 +100,7 @@ var TYPE_NAMES = [MT_DIM]string{ "error", "absent", "void", - "str", + "string", "int", "float", "bool",