github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/lang/redirection_test.go (about) 1 package lang_test 2 3 import ( 4 "testing" 5 6 _ "github.com/lmorg/murex/builtins" 7 "github.com/lmorg/murex/test" 8 ) 9 10 func TestRedirection(t *testing.T) { 11 tests := []test.MurexTest{ 12 { 13 Block: "out control test", 14 Stdout: "control test\n", 15 Stderr: "", 16 ExitNum: 0, 17 }, 18 { 19 Block: "out <err> redirect out", 20 Stdout: "", 21 Stderr: "redirect out\n", 22 ExitNum: 0, 23 }, 24 25 { 26 Block: "err control test", 27 Stdout: "", 28 Stderr: "control test\n", 29 ExitNum: 1, 30 }, 31 { 32 Block: "out <!out> redirect err", 33 Stdout: "redirect err\n", 34 Stderr: "", 35 ExitNum: 0, 36 }, 37 38 // null pipes 39 40 { 41 Block: "out <null> null pipe", 42 Stdout: "", 43 Stderr: "", 44 ExitNum: 0, 45 }, 46 { 47 Block: "err <!null> null pipe", 48 Stdout: "", 49 Stderr: "", 50 ExitNum: 1, 51 }, 52 53 // pipelines 54 55 { 56 Block: "regexp <!null> -> match ' '", 57 Stdout: "", 58 Stderr: "", 59 ExitNum: 0, 60 }, 61 /*{ 62 Block: "regexp <!out> -> match ' '", 63 Stdout: "Error in `regexp` (0,1): `regexp` expects to be pipelined\n", 64 Stderr: "", 65 ExitNum: 0, 66 },*/ 67 } 68 69 test.RunMurexTests(tests, t) 70 } 71 72 func TestRedirectionParserBug(t *testing.T) { 73 tests := []test.MurexTest{ 74 { 75 Block: "$ARGS -> [ <!null> 10 ]", 76 Stdout: "", 77 Stderr: "", 78 ExitNum: 1, 79 }, 80 } 81 82 test.RunMurexTests(tests, t) 83 }