github.com/mem/u-root@v2.0.1-0.20181004165302-9b18b4636a33+incompatible/cmds/elvish/eval/ns_test.go (about)

     1  package eval
     2  
     3  import "testing"
     4  
     5  func TestNs(t *testing.T) {
     6  	runTests(t, []Test{
     7  		That("kind-of (ns [&])").Puts("ns"),
     8  		// A Ns is only equal to itself
     9  		That("ns = (ns [&]); eq $ns $ns").Puts(true),
    10  		That("eq (ns [&]) (ns [&])").Puts(false),
    11  		That("eq (ns [&]) [&]").Puts(false),
    12  
    13  		That(`ns: = (ns [&a=b &x=y]); put $ns:a`).Puts("b"),
    14  		That(`ns: = (ns [&a=b &x=y]); put $ns:[a]`).Puts("b"),
    15  		// Test multi-key ns when sorting is possible
    16  		That(`keys (ns [&a=b])`).Puts("a"),
    17  		That(`has-key (ns [&a=b &x=y]) a`).Puts(true),
    18  		That(`has-key (ns [&a=b &x=y]) b`).Puts(false),
    19  	})
    20  }