github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/lang/process_test.go (about) 1 package lang_test 2 3 import ( 4 "testing" 5 6 "github.com/lmorg/murex/config" 7 "github.com/lmorg/murex/config/defaults" 8 "github.com/lmorg/murex/lang" 9 "github.com/lmorg/murex/lang/types" 10 "github.com/lmorg/murex/shell" 11 "github.com/lmorg/murex/test" 12 ) 13 14 /* Bug fix: 15 » function abc { config: set proc echo true ; out: testing; a: [1..3] } 16 » abc 17 panic: interface conversion: interface {} is string, not bool 18 19 goroutine 922 [running]: 20 github.com/lmorg/murex/lang.executeProcess(0xc0001082b0) 21 /Users/laurencemorgan/go/src/github.com/lmorg/murex/lang/process.go:196 +0x158d 22 created by github.com/lmorg/murex/lang.runModeNormal 23 /Users/laurencemorgan/go/src/github.com/lmorg/murex/lang/interpreter.go:180 +0x7e 24 murex-dev» 25 */ 26 func TestBugFix(t *testing.T) { 27 config.InitConf.Define("proc", "echo", config.Properties{ 28 Description: "Echo shell functions", 29 Default: false, 30 DataType: types.Boolean, 31 }) 32 lang.InitEnv() 33 defaults.Config(lang.ShellProcess.Config, false) 34 shell.SignalHandler(false) 35 36 tests := []test.MurexTest{ 37 { 38 Block: ` 39 function TestBugFix { 40 config: set proc echo true 41 out: testing 42 a: [1..3] 43 } 44 TestBugFix 45 `, 46 Stdout: "testing\n1\n2\n3\n", 47 }, 48 } 49 50 test.RunMurexTests(tests, t) 51 }