github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/lang/expressions/parse_quoteP_test.go (about) 1 package expressions 2 3 import ( 4 "testing" 5 6 "github.com/lmorg/murex/test" 7 ) 8 9 func TestParseQuoteParenthesis(t *testing.T) { 10 tests := []testParseStatementT{ 11 { 12 Statement: `regexp <!null> (f#/proc/[0-9]+/fd/([0-9]+))`, 13 Args: []string{ 14 "regexp", "(f#/proc/[0-9]+/fd/([0-9]+))", 15 }, 16 Pipes: []string{ 17 "!null", 18 }, 19 Exec: false, 20 }, 21 { 22 Statement: `regexp <!null> (f#/proc/[0-9]+/fd/([0-9]+))`, 23 Args: []string{ 24 "regexp", "f#/proc/[0-9]+/fd/([0-9]+)", 25 }, 26 Pipes: []string{ 27 "!null", 28 }, 29 Exec: true, 30 }, 31 } 32 33 testParseStatement(t, tests) 34 } 35 36 func TestParseQuoteParenthesisBlock(t *testing.T) { 37 tests := []test.MurexTest{ 38 { 39 Block: `echo <!null> (f#/proc/[0-9]+/fd/([0-9]+))`, 40 Stdout: "f#/proc/[0-9]+/fd/([0-9]+)\n", 41 }, 42 { 43 Block: `echo <!null> /proc/0/fd/3 -> regexp <!null> (f#/proc/[0-9]+/fd/([0-9]+)) -> match <!null> 3`, 44 Stdout: "3\n", 45 }, 46 { 47 Block: `echo (m/(NAME|PATTERN)/)`, 48 Stdout: "m/(NAME|PATTERN)/\n", 49 }, 50 } 51 52 test.RunMurexTests(tests, t) 53 } 54 55 func TestParseQuoteParenthesisNestedWithVar(t *testing.T) { 56 tests := []test.MurexTest{ 57 { 58 Block: ` 59 TestParseQuoteParenthesisNestedWithVar="foobar" 60 echo (($TestParseQuoteParenthesisNestedWithVar)) 61 `, 62 Stdout: "(foobar)\n", 63 }, 64 { 65 Block: ` 66 TestParseQuoteParenthesisNestedWithVar="foobar" 67 echo ({$TestParseQuoteParenthesisNestedWithVar}) 68 `, 69 Stdout: "{foobar}\n", 70 }, 71 } 72 73 test.RunMurexTests(tests, t) 74 }