github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/core/io/echo_test.go (about) 1 package io 2 3 import ( 4 "testing" 5 6 "github.com/lmorg/murex/test" 7 ) 8 9 // TestOut tests the `out` builtin 10 func TestOut(t *testing.T) { 11 tests := []test.MurexTest{ 12 { 13 Block: "out: test", 14 Stdout: "test\n", 15 }, 16 { 17 Block: "out: t e s t", 18 Stdout: "t e s t\n", 19 }, 20 { 21 Block: "echo: test", 22 Stdout: "test\n", 23 }, 24 { 25 Block: "echo: t e s t", 26 Stdout: "t e s t\n", 27 }, 28 } 29 test.RunMurexTests(tests, t) 30 } 31 32 // TestTout tests the `tout` builtin 33 func TestTout(t *testing.T) { 34 tests := []test.MurexTest{ 35 { 36 Block: "tout: str test", 37 Stdout: "test", 38 }, 39 { 40 Block: "tout: str t e s t", 41 Stdout: "t e s t", 42 }, 43 } 44 test.RunMurexTests(tests, t) 45 } 46 47 // TestBrace tests the `(` builtin 48 func TestBrace(t *testing.T) { 49 tests := []test.MurexTest{ 50 { 51 Block: "(test)", 52 Stdout: "test", 53 }, 54 { 55 Block: "(t e s t)", 56 Stdout: "t e s t", 57 }, 58 } 59 test.RunMurexTests(tests, t) 60 } 61 62 // TestErr tests the `err` builtin 63 func TestErr(t *testing.T) { 64 tests := []test.MurexTest{ 65 { 66 Block: "err: test", 67 Stderr: "test\n", 68 ExitNum: 1, 69 }, 70 { 71 Block: "err: t e s t", 72 Stderr: "t e s t\n", 73 ExitNum: 1, 74 }, 75 } 76 test.RunMurexTests(tests, t) 77 }