Skip to content

Instantly share code, notes, and snippets.

@colomon
Created June 6, 2013 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colomon/5725455 to your computer and use it in GitHub Desktop.
Save colomon/5725455 to your computer and use it in GitHub Desktop.
Tests for the behavior of .Set.
{
isa_ok "a".Set, Set, "Str.Set makes a Set";
is showset("a".Set), 'a', "'a'.Set is set a";
isa_ok (a => 1).Set, Set, "Pair.Set makes a Set";
is showset((a => 1).Set), 'a', "(a => 1).Set is set a";
is showset((a => 0).Set), '', "(a => 0).Set is the empty set";
isa_ok <a b c>.Set, Set, "<a b c>.Set makes a Set";
is showset(<a b c a>.Set), 'a b c', "<a b c a>.Set makes the set a b c";
is showset(["a", "b", "c", "a"].Set), 'a b c', "[a b c a].Set makes the set a b c";
is showset([a => 3, b => 0, 'c', 'a'].Set), 'a c', "[a => 3, b => 0, 'c', 'a'].Set makes the set a c";
isa_ok {a => 2, b => 4, c => 0}.Set, Set, "{a => 2, b => 4, c => 0}.Set makes a Set";
is showset({a => 2, b => 4, c => 0}.Set), 'a b', "{a => 2, b => 4, c => 0}.Set makes the set a b";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment