github.com/neugram/ng@v0.0.0-20180309130942-d472ff93d872/eval/testdata/shell4.ng (about) 1 ok := true 2 3 if x := $$ echo -n {a,b}c $$; x != "ac bc" { 4 print("brace expansion failed:", x) 5 ok = false 6 } 7 /* TODO if x := $$ echo -n {a,}b $$; x != "ab b" { 8 print("empty-last brace expansion failed:", x) 9 ok = false 10 }*/ 11 if x := $$ echo -n {,a}b $$; x != "b ab" { 12 print("empty-first brace expansion failed:", x) 13 ok = false 14 } 15 if x := $$ echo -n a{2..4}b $$; x != "a2b a3b a4b" { 16 print("brace numeric expansion failed:", x) 17 ok = false 18 } 19 if x := $$ echo -n a{3..1}b $$; x != "a3b a2b a1b" { 20 print("brace reverse numeric expansion failed:", x) 21 ok = false 22 } 23 if x := $$ echo -n "{a,b}c" $$; x != "{a,b}c" { 24 print("quoted braces misbehaved:", x) 25 ok = false 26 } 27 if x := $$ echo -n "\"" $$; x != `"` { 28 print("quoted quote misbehaved:", x) 29 ok = false 30 } 31 if x := $$ echo -n "\`" $$; x != "`" { 32 print("quoted backtick misbehaved:", x) 33 ok = false 34 } 35 if x := $$ echo -n not_a_file_* $$; x != "" { 36 print("found a file we should not:", x) 37 ok = false 38 } 39 if x := $$ echo -n "not_a_file_*" $$; x != "not_a_file_*" { 40 print("incorrectly expanded *:", x) 41 ok = false 42 } 43 if x := $$ echo -n "~" $$; x != "~" { 44 print("incorrectly expanded double-quoted ~:", x) 45 ok = false 46 } 47 if x := $$ echo -n '~' $$; x != "~" { 48 print("incorrectly expanded single-quoted ~:", x) 49 ok = false 50 } 51 if x := $$ echo -n ~ $$; x == "~" { 52 print("did not expand ~:", x) 53 ok = false 54 } 55 if x := $$ echo -n $ $$; x != "$" { 56 print("individual $ did not print:", x) 57 ok = false 58 } 59 aparam := "v1" 60 v := "vee2" 61 if x := $$ echo -n _$aparam${aparam}$v${v}$notaval_ $$; x != "_v1v1vee2vee2_" { 62 print("did not expand params:", x) 63 ok = false 64 } 65 if x := $$ echo -n "$v" $$; x != "vee2" { 66 print("did not expand quoted param:", x) 67 ok = false 68 } 69 if x := $$ VAL=v3 env | grep VAL=v3 $$; x != "VAL=v3\n" { 70 print("bad env:", x) 71 ok = false 72 } 73 if x := $$ echo -n \*.h $$; x != "*.h" { 74 print("escaped * malfunctioned:", x) 75 ok = false 76 } 77 if x := $$ echo -n \" $$; x != `"` { 78 print("escaped quote malfunctioned:", x) 79 ok = false 80 } 81 if x := $$ echo -n a\;b {} \; $$; x != `a;b {} ;` { 82 print("escaped control characters malfunctioned:", x) 83 ok = false 84 } 85 if x := $$ A=B echo -n C=D $$; x != "C=D" { 86 printf("echo missed argument with '=': %q", x) 87 ok = false 88 } 89 90 if ok { 91 print("OK") 92 }