accept-case ./reg-test/cases/case-c-dsl-mapvar-assignments.sh

This commit is contained in:
John Kerl 2021-03-01 23:58:30 -05:00
parent c02d5b1ede
commit 0afb99d20f
3 changed files with 19 additions and 40 deletions

3
go/gg
View file

@ -52,6 +52,7 @@ mention() {
# ================================================================
run_mlr --oxtab fraction -f x,y -g a -p -c ./reg-test/input/abixy-het
mlr --from ./reg-test/input/abixy put '@o[1][2][3] = 7; for(k1,v in @o[1][2]) {$x+=10;$y+=100}'
mlr --from ./reg-test/input/xyz2 put -q 'map o = @o; dump o'
# ================================================================

View file

@ -4,52 +4,49 @@
MAPVAR ASSIGNMENTS TO FULL SREC
mlr --from ./reg-test/input/xyz2 put $* = {"a":1, "b": {"x":8,"y":9}, "c":3}
a=1,c=3
a=1,c=3
a=1,b.x=8,b.y=9,c=3
a=1,b.x=8,b.y=9,c=3
mlr --from ./reg-test/input/xyz2 put $* = $*
x=3,y=4,z=5
x=6,y=7,u=8
mlr --from ./reg-test/input/xyz2 put @a = 1; $* = @a
Exit status was 1; expected 0.
mlr --from ./reg-test/input/xyz2 put @b[1] = 2; $* = @b
1=2
1=2
mlr --from ./reg-test/input/xyz2 put @c[1][2] = 3; $* = @c
1.2=3
1.2=3
mlr --from ./reg-test/input/xyz2 put @a = 1; $* = @*
a=1
a=1
mlr --from ./reg-test/input/xyz2 put @b[1] = 2; $* = @*
b.1=2
b.1=2
mlr --from ./reg-test/input/xyz2 put @c[1][2] = 3; $* = @*
c.1.2=3
c.1.2=3
mlr --from ./reg-test/input/xyz2 put a = 1; $* = a
Exit status was 1; expected 0.
mlr --from ./reg-test/input/xyz2 put b[1] = 2; $* = b
1=2
1=2
mlr --from ./reg-test/input/xyz2 put c[1][2] = 3; $* = c
1.2=3
1.2=3
mlr --from ./reg-test/input/xyz2 put $* = 3
Exit status was 1; expected 0.
mlr --from ./reg-test/input/xyz2 put
func map_valued_func() {
@ -145,12 +142,7 @@ x=3,y=4,z=5
x=6,y=7,u=8
mlr --from ./reg-test/input/xyz2 put @a = 1; @* = @a; dump
{
}
x=3,y=4,z=5
{
}
x=6,y=7,u=8
Exit status was 1; expected 0.
mlr --from ./reg-test/input/xyz2 put @b[1] = 2; @* = @b; dump
{
@ -219,12 +211,7 @@ x=3,y=4,z=5
x=6,y=7,u=8
mlr --from ./reg-test/input/xyz2 put a = 1; @* = a; dump
{
}
x=3,y=4,z=5
{
}
x=6,y=7,u=8
Exit status was 1; expected 0.
mlr --from ./reg-test/input/xyz2 put b[1] = 2; @* = b; dump
{
@ -251,8 +238,7 @@ x=3,y=4,z=5
x=6,y=7,u=8
mlr --from ./reg-test/input/xyz2 put @* = 3
x=3,y=4,z=5
x=6,y=7,u=8
Exit status was 1; expected 0.
mlr --from ./reg-test/input/xyz2 put
func map_valued_func() {
@ -315,8 +301,6 @@ mlr --from ./reg-test/input/xyz2 put -q @o = {"a":1, "b": {"x":8,"y":9}, "c":3};
mlr --from ./reg-test/input/xyz2 put -q @o = @o; dump @o
mlr --from ./reg-test/input/xyz2 put -q @o = {"a":1, "b": {"x":8,"y":9}, "c":3}; dump; @o = @*; dump
{
"o": {
@ -559,7 +543,7 @@ mlr --from ./reg-test/input/xyz2 put -q map o = {"a":1, "b": {"x":8,"y":9}, "c":
}
mlr --from ./reg-test/input/xyz2 put -q map o = @o; dump o
mlr: map type assertion for variable o unmet by value "" with type absent.
Exit status was 0; expected 1.
mlr --from ./reg-test/input/xyz2 put -q map o = $*; dump o
{
@ -592,7 +576,6 @@ mlr --from ./reg-test/input/xyz2 put -q map o = {"a":1, "b": {"x":8,"y":9}, "c":
}
mlr --from ./reg-test/input/xyz2 put -q @a = 1; map o = @a; dump o
mlr: map type assertion for variable o unmet by value 1 with type int.
mlr --from ./reg-test/input/xyz2 put -q @b[1] = 2; map o = @b; dump o
{
@ -651,7 +634,6 @@ mlr --from ./reg-test/input/xyz2 put -q @c[1][2] = 3; map o = @*; dump o
}
mlr --from ./reg-test/input/xyz2 put -q a = 1; map o = a; dump o
mlr: map type assertion for variable o unmet by value 1 with type int.
mlr --from ./reg-test/input/xyz2 put -q b[1] = 2; map o = b; dump o
{
@ -707,8 +689,6 @@ mlr --from ./reg-test/input/xyz2 put -q var o = {"a":1, "b": {"x":8,"y":9}, "c":
mlr --from ./reg-test/input/xyz2 put -q var o = @o; dump o
mlr --from ./reg-test/input/xyz2 put -q var o = $*; dump o
{
"x": 3,
@ -857,8 +837,6 @@ mlr --from ./reg-test/input/xyz2 put -q o = {"a":1, "b": {"x":8,"y":9}, "c":3};
mlr --from ./reg-test/input/xyz2 put -q o = @o; dump o
mlr --from ./reg-test/input/xyz2 put -q o = $*; dump o
{
"x": 3,