elvish/pkg/eval/ns_test.elvts
2024-01-30 20:21:39 +00:00

36 lines
478 B
Plaintext

//////
# ns #
//////
~> kind-of (ns [&])
▶ ns
## equality ##
// an Ns is only equal to itself ##
~> var ns = (ns [&])
eq $ns $ns
▶ $true
~> eq (ns [&]) (ns [&])
▶ $false
~> eq (ns [&]) [&]
▶ $false
## access ##
~> var ns: = (ns [&a=b &x=y])
put $ns:a
▶ b
~> var ns: = (ns [&a=b &x=y])
put $ns:[a]
▶ b
## keys ##
~> keys (ns [&a=b &x=y]) | order
▶ a
▶ x
## has-key ##
~> has-key (ns [&a=b &x=y]) a
▶ $true
~> has-key (ns [&a=b &x=y]) b
▶ $false