github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/main_test.go (about)

     1  package main
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/lmorg/murex/lang"
     7  	"github.com/lmorg/murex/test/count"
     8  )
     9  
    10  // TestMurex tests murex runtime environment can be initialized and and simple
    11  // command line can execute
    12  func TestMurex(t *testing.T) {
    13  	count.Tests(t, 1)
    14  
    15  	lang.InitEnv()
    16  
    17  	block := []rune("a [Mon..Fri]->regexp m/^T/")
    18  
    19  	_, err := lang.ShellProcess.Fork(lang.F_NO_STDIN | lang.F_NO_STDOUT | lang.F_NO_STDERR).Execute(block)
    20  	if err != nil {
    21  		t.Error(err.Error())
    22  	}
    23  }
    24  
    25  func TestRunCommandLine(t *testing.T) {
    26  	count.Tests(t, 1)
    27  
    28  	runCommandLine(`out: "testing" -> null`)
    29  }
    30  
    31  func TestRunSource(t *testing.T) {
    32  	count.Tests(t, 1)
    33  
    34  	file := "test/source.mx"
    35  	runSource(file)
    36  }
    37  
    38  func TestRunSourceGzMods(t *testing.T) {
    39  	count.Tests(t, 1)
    40  
    41  	file := "test/source.mx.gz"
    42  	runSource(file)
    43  }