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

     1  package parser_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	_ "github.com/lmorg/murex/builtins"
     7  	"github.com/lmorg/murex/lang"
     8  	"github.com/lmorg/murex/test/count"
     9  	"github.com/lmorg/murex/utils/parser"
    10  )
    11  
    12  func TestIsSafeCmdsBuiltins(t *testing.T) {
    13  	safeCmdsLocal := parser.GetSafeCmds()
    14  
    15  	count.Tests(t, len(safeCmdsLocal))
    16  
    17  	for _, cmd := range safeCmdsLocal {
    18  		if lang.GoFunctions[cmd] == nil {
    19  			t.Errorf("Command hardcoded in safe whitelist but is not a builtin: %s", cmd)
    20  		}
    21  	}
    22  }