github.com/kolbycrouch/elvish@v0.14.1-0.20210614162631-215b9ac1c423/pkg/eval/mods/bundled/bundled_test.go (about)

     1  package bundled_test
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  
     7  	"src.elv.sh/pkg/cli"
     8  	"src.elv.sh/pkg/edit"
     9  	"src.elv.sh/pkg/eval"
    10  	. "src.elv.sh/pkg/eval/evaltest"
    11  	"src.elv.sh/pkg/eval/mods/re"
    12  	"src.elv.sh/pkg/eval/mods/str"
    13  )
    14  
    15  func TestEPM(t *testing.T) {
    16  	// A smoke test to ensure that the epm module has no errors.
    17  
    18  	TestWithSetup(t, func(ev *eval.Evaler) {
    19  		// TODO: It shouldn't be necessary to do this setup manually. Instead,
    20  		// there should be a function that initializes an Evaler with all the
    21  		// standard modules.
    22  		ev.AddModule("re", re.Ns)
    23  		ev.AddModule("str", str.Ns)
    24  	},
    25  		That("use epm").DoesNothing(),
    26  	)
    27  }
    28  
    29  func TestReadlineBinding(t *testing.T) {
    30  	// A smoke test to ensure that the readline-binding module has no errors.
    31  
    32  	TestWithSetup(t, func(ev *eval.Evaler) {
    33  		ed := edit.NewEditor(cli.NewTTY(os.Stdin, os.Stderr), ev, nil)
    34  		ev.AddBuiltin(eval.NsBuilder{}.AddNs("edit", ed.Ns()).Ns())
    35  	},
    36  		That("use readline-binding").DoesNothing(),
    37  	)
    38  }