github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/lang/expressions/parse_comment_test.go (about) 1 package expressions 2 3 import ( 4 "testing" 5 6 "github.com/lmorg/murex/test" 7 ) 8 9 func TestParseCommentMultiLineStatement(t *testing.T) { 10 tests := []testParseStatementT{ 11 { 12 Statement: `echo /# this is an infixed comment #/ foo bar`, 13 Args: []string{ 14 "echo", "foo", "bar", 15 }, 16 Exec: false, 17 }, 18 { 19 Statement: `echo /# this is an infixed comment #/ foo bar`, 20 Args: []string{ 21 "echo", "foo", "bar", 22 }, 23 Exec: true, 24 }, 25 /// 26 { 27 Statement: `echo/# this is an infixed comment #/ foo bar`, 28 Args: []string{ 29 "echo", "foo", "bar", 30 }, 31 Exec: false, 32 }, 33 { 34 Statement: `echo/# this is an infixed comment #/ foo bar`, 35 Args: []string{ 36 "echo", "foo", "bar", 37 }, 38 Exec: true, 39 }, 40 /// 41 { 42 Statement: `echo /# this is an infixed comment #/foo bar`, 43 Args: []string{ 44 "echo", "foo", "bar", 45 }, 46 Exec: false, 47 }, 48 { 49 Statement: `echo /# this is an infixed comment #/foo bar`, 50 Args: []string{ 51 "echo", "foo", "bar", 52 }, 53 Exec: true, 54 }, 55 } 56 57 testParseStatement(t, tests) 58 } 59 60 func TestParseCommentMultiLine(t *testing.T) { 61 tests := []test.MurexTest{ 62 { 63 Block: `3 /#* 4 #/+ 5`, 64 Stdout: `8`, 65 }, 66 { 67 Block: `/# foobar #/ out test`, 68 Stdout: "test\n", 69 }, 70 { 71 Block: `%[ 1 2 /#3#/ 4 ]`, 72 Stdout: `[1,2,4]`, 73 }, 74 { 75 Block: `%{ a:1, b:2, /#c:3#/ d:4 }`, 76 Stdout: `{"a":1,"b":2,"d":4}`, 77 }, 78 } 79 80 test.RunMurexTests(tests, t) 81 }