From 3de94c8a341ef3f19fd75eeeb98e5333d2fe89d0 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 5 Apr 2018 06:18:46 -0400 Subject: - Re-named "is" to "is?". --- stdlib/test/test/lux.lux | 14 ++++++------- stdlib/test/test/lux/control/parser.lux | 9 --------- stdlib/test/test/lux/data/coll/array.lux | 6 +++--- stdlib/test/test/lux/data/coll/bits.lux | 8 ++++---- stdlib/test/test/lux/data/coll/sequence.lux | 2 +- stdlib/test/test/lux/data/coll/stack.lux | 6 +++--- stdlib/test/test/lux/data/coll/tree/zipper.lux | 28 +++++++++++++------------- stdlib/test/test/lux/data/ident.lux | 4 ++-- stdlib/test/test/lux/data/lazy.lux | 8 ++++---- stdlib/test/test/lux/host.js.lux | 22 ++++++++++---------- stdlib/test/test/lux/macro/syntax.lux | 10 ++++----- stdlib/test/test/lux/math/constructive.lux | 2 +- 12 files changed, 55 insertions(+), 64 deletions(-) (limited to 'stdlib/test') diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux index f5c5fd2f1..b8861eab6 100644 --- a/stdlib/test/test/lux.lux +++ b/stdlib/test/test/lux.lux @@ -18,11 +18,11 @@ y (r.text size)] ($_ seq (test "Every value is identical to itself, and the 'id' function doesn't change values in any way." - (and (is x x) - (is x (id x)))) + (and (is? x x) + (is? x (id x)))) (test "Values created separately can't be identical." - (not (is x y))) + (not (is? x y))) )))) (do-template [category rand-gen inc dec even? odd? = < >] @@ -183,11 +183,11 @@ false))) (test "Can have defaults for Maybe values." - (and (is "yolo" (maybe.default "yolo" - #.None)) + (and (is? "yolo" (maybe.default "yolo" + #.None)) - (is "lol" (maybe.default "yolo" - (#.Some "lol"))))) + (is? "lol" (maybe.default "yolo" + (#.Some "lol"))))) )) (template: (hypotenuse x y) diff --git a/stdlib/test/test/lux/control/parser.lux b/stdlib/test/test/lux/control/parser.lux index 64e8fac32..ae69d8ec9 100644 --- a/stdlib/test/test/lux/control/parser.lux +++ b/stdlib/test/test/lux/control/parser.lux @@ -42,15 +42,6 @@ _ false)) -(def: (is? Eq test parser input) - (All [s a] (-> (Eq a) a (&.Parser s a) s Bool)) - (case (&.run input parser) - (#E.Success [_ output]) - (:: Eq = test output) - - _ - false)) - (def: (fails? input) (All [a] (-> (E.Error a) Bool)) (case input diff --git a/stdlib/test/test/lux/data/coll/array.lux b/stdlib/test/test/lux/data/coll/array.lux index cd834a41e..289e7e988 100644 --- a/stdlib/test/test/lux/data/coll/array.lux +++ b/stdlib/test/test/lux/data/coll/array.lux @@ -30,11 +30,11 @@ (n/= size (@.size original))) (test "Cloning an array should yield and identical array, but not the same one." (and (:: (@.Eq number.Eq) = original clone) - (not (is original clone)))) + (not (is? original clone)))) (test "Full-range manual copies should give the same result as cloning." (exec (@.copy size +0 original +0 copy) (and (:: (@.Eq number.Eq) = original copy) - (not (is original copy))))) + (not (is? original copy))))) (test "Array folding should go over all values." (exec (:: @.Fold fold (function [x idx] @@ -107,7 +107,7 @@ (test "Functor shouldn't alter original array." (let [copy (map id array)] (and (= array copy) - (not (is array copy))))) + (not (is? array copy))))) (test "Functor should go over all available array elements." (let [there (map n/inc array) back-again (map n/dec there)] diff --git a/stdlib/test/test/lux/data/coll/bits.lux b/stdlib/test/test/lux/data/coll/bits.lux index ccf0ff63d..d33fa61b1 100644 --- a/stdlib/test/test/lux/data/coll/bits.lux +++ b/stdlib/test/test/lux/data/coll/bits.lux @@ -44,7 +44,7 @@ (test "Bits (must) shrink when (and as much as) possible." (let [grown (/.flip idx /.empty)] (and (n/> +0 (/.capacity grown)) - (is /.empty (/.flip idx grown))))) + (is? /.empty (/.flip idx grown))))) (test "Intersection can be detected when there are set bits in common." (and (not (/.intersects? /.empty @@ -59,14 +59,14 @@ (test "'and' with oneself changes nothing" (:: /.Eq = sample (/.and sample sample))) (test "'and' with one's opposite yields the empty bit-set." - (is /.empty (/.and sample (/.not sample)))) + (is? /.empty (/.and sample (/.not sample)))) (test "'or' with one's opposite fully saturates a bit-set." (n/= (/.size (/.or sample (/.not sample))) (/.capacity sample))) (test "'xor' with oneself yields the empty bit-set." - (is /.empty (/.xor sample sample))) + (is? /.empty (/.xor sample sample))) (test "'xor' with one's opposite fully saturates a bit-set." (n/= (/.size (/.xor sample (/.not sample))) (/.capacity sample))) @@ -74,7 +74,7 @@ (test "Double negation results in original bit-set." (:: /.Eq = sample (/.not (/.not sample)))) (test "Negation does not affect the empty bit-set." - (is /.empty (/.not /.empty))) + (is? /.empty (/.not /.empty))) (_eq.spec /.Eq ..bits) )))) diff --git a/stdlib/test/test/lux/data/coll/sequence.lux b/stdlib/test/test/lux/data/coll/sequence.lux index 145493c3e..afeca6154 100644 --- a/stdlib/test/test/lux/data/coll/sequence.lux +++ b/stdlib/test/test/lux/data/coll/sequence.lux @@ -37,7 +37,7 @@ (&.put idx non-member) (&.nth idx) maybe.assume - (is non-member))) + (is? non-member))) (test "Can update elements of sequences." (|> sample diff --git a/stdlib/test/test/lux/data/coll/stack.lux b/stdlib/test/test/lux/data/coll/stack.lux index c5f1e598f..216c1a8c5 100644 --- a/stdlib/test/test/lux/data/coll/stack.lux +++ b/stdlib/test/test/lux/data/coll/stack.lux @@ -37,9 +37,9 @@ )) (test "Pushing onto a stack always increases it by 1, adding a new value at the top." - (and (is sample - (&.pop (&.push new-top sample))) + (and (is? sample + (&.pop (&.push new-top sample))) (n/= (n/inc (&.size sample)) (&.size (&.push new-top sample))) (|> (&.push new-top sample) &.peek maybe.assume - (is new-top)))) + (is? new-top)))) )))) diff --git a/stdlib/test/test/lux/data/coll/tree/zipper.lux b/stdlib/test/test/lux/data/coll/tree/zipper.lux index 1347ee7bd..831cc9573 100644 --- a/stdlib/test/test/lux/data/coll/tree/zipper.lux +++ b/stdlib/test/test/lux/data/coll/tree/zipper.lux @@ -52,8 +52,8 @@ (if (&.branch? zipper) (let [child (|> zipper &.down)] (and (not (tree/= sample (&.unzip child))) - (|> child &.up (is zipper) not) - (|> child &.root (is zipper) not))) + (|> child &.up (is? zipper) not) + (|> child &.root (is? zipper) not))) (and (&.leaf? zipper) (|> zipper (&.prepend-child new-val) &.branch?))))) @@ -64,12 +64,12 @@ zipper (|> zipper (&.prepend-child pre-val) (&.append-child post-val))] - (and (|> zipper &.down &.value (is pre-val)) - (|> zipper &.down &.right &.value (is mid-val)) - (|> zipper &.down &.right &.right &.value (is post-val)) - (|> zipper &.down &.rightmost &.leftmost &.value (is pre-val)) - (|> zipper &.down &.right &.left &.value (is pre-val)) - (|> zipper &.down &.rightmost &.value (is post-val)))) + (and (|> zipper &.down &.value (is? pre-val)) + (|> zipper &.down &.right &.value (is? mid-val)) + (|> zipper &.down &.right &.right &.value (is? post-val)) + (|> zipper &.down &.rightmost &.leftmost &.value (is? pre-val)) + (|> zipper &.down &.right &.left &.value (is? pre-val)) + (|> zipper &.down &.rightmost &.value (is? post-val)))) true))) (test "Can insert children around a node (unless it's root)." @@ -83,12 +83,12 @@ (&.insert-right post-val) maybe.assume &.up)] - (and (|> zipper &.down &.value (is pre-val)) - (|> zipper &.down &.right &.value (is mid-val)) - (|> zipper &.down &.right &.right &.value (is post-val)) - (|> zipper &.down &.rightmost &.leftmost &.value (is pre-val)) - (|> zipper &.down &.right &.left &.value (is pre-val)) - (|> zipper &.down &.rightmost &.value (is post-val)))) + (and (|> zipper &.down &.value (is? pre-val)) + (|> zipper &.down &.right &.value (is? mid-val)) + (|> zipper &.down &.right &.right &.value (is? post-val)) + (|> zipper &.down &.rightmost &.leftmost &.value (is? pre-val)) + (|> zipper &.down &.right &.left &.value (is? pre-val)) + (|> zipper &.down &.rightmost &.value (is? post-val)))) (and (|> zipper (&.insert-left pre-val) (case> (#.Some _) false #.None true)) (|> zipper (&.insert-right post-val) (case> (#.Some _) false diff --git a/stdlib/test/test/lux/data/ident.lux b/stdlib/test/test/lux/data/ident.lux index 2e3b59853..d6732619e 100644 --- a/stdlib/test/test/lux/data/ident.lux +++ b/stdlib/test/test/lux/data/ident.lux @@ -32,8 +32,8 @@ (^open "&/") &.Codec]] ($_ seq (test "Can get the module & name parts of an ident." - (and (is module1 (&.module ident1)) - (is name1 (&.name ident1)))) + (and (is? module1 (&.module ident1)) + (is? name1 (&.name ident1)))) (test "Can compare idents for equality." (and (&/= ident1 ident1) diff --git a/stdlib/test/test/lux/data/lazy.lux b/stdlib/test/test/lux/data/lazy.lux index c007990de..1b8a76730 100644 --- a/stdlib/test/test/lux/data/lazy.lux +++ b/stdlib/test/test/lux/data/lazy.lux @@ -18,10 +18,10 @@ (n/= expected (&.thaw lazy))) (test "Lazy values only evaluate once." - (and (not (is expected - (&.thaw lazy))) - (is (&.thaw lazy) - (&.thaw lazy)))) + (and (not (is? expected + (&.thaw lazy))) + (is? (&.thaw lazy) + (&.thaw lazy)))) )))) (context: "Functor, Applicative, Monad." diff --git a/stdlib/test/test/lux/host.js.lux b/stdlib/test/test/lux/host.js.lux index c7d65343a..49b15d7e4 100644 --- a/stdlib/test/test/lux/host.js.lux +++ b/stdlib/test/test/lux/host.js.lux @@ -1,4 +1,4 @@ -(;module: +(.module: lux (lux [io] (control ["M" monad #+ do Monad]) @@ -10,22 +10,22 @@ (context: "JavaScript operations" ($_ seq (test "Null equals itself." - (is (&;null) (&;null))) + (is? (&.null) (&.null))) (test "Undefined equals itself." - (is (&;undef) (&;undef))) + (is? (&.undef) (&.undef))) (test "Can reference JavaScript objects." - (is (&;ref "Math") (&;ref "Math"))) + (is? (&.ref "Math") (&.ref "Math"))) (test "Can create objects and access their fields." - (|> (&;object "foo" "BAR") - (&;get "foo" Text) - (is "BAR"))) + (|> (&.object "foo" "BAR") + (&.get "foo" Text) + (is? "BAR"))) (test "Can call JavaScript functions" - (and (is 124.0 - (&;call! (&;ref "Math.ceil" &;Function) [123.45] Frac)) - (is 124.0 - (&;call! (&;ref "Math") "ceil" [123.45] Frac)))) + (and (is? 124.0 + (&.call! (&.ref "Math.ceil" &.Function) [123.45] Frac)) + (is? 124.0 + (&.call! (&.ref "Math") "ceil" [123.45] Frac)))) )) diff --git a/stdlib/test/test/lux/macro/syntax.lux b/stdlib/test/test/lux/macro/syntax.lux index f53af1cb7..5c5ea835f 100644 --- a/stdlib/test/test/lux/macro/syntax.lux +++ b/stdlib/test/test/lux/macro/syntax.lux @@ -9,7 +9,7 @@ [number] [bool] [ident] - ["E" error]) + ["e" error]) ["r" math/random] [macro] (macro [code] @@ -35,17 +35,17 @@ _ false)) -(def: (is? Eq test parser input) +(def: (equals? Eq reference parser input) (All [a] (-> (Eq a) a (Syntax a) (List Code) Bool)) (case (p.run input parser) (#.Right [_ output]) - (:: Eq = test output) + (:: Eq = reference output) _ false)) (def: (fails? input) - (All [a] (-> (E.Error a) Bool)) + (All [a] (-> (e.Error a) Bool)) (case input (#.Left _) true @@ -66,7 +66,7 @@ (with-expansions [ (do-template [ ] [(test - (and (is? (list ( ))) + (and (equals? (list ( ))) (found? (s.this? ( )) (list ( ))) (enforced? (s.this ( )) (list ( )))))] diff --git a/stdlib/test/test/lux/math/constructive.lux b/stdlib/test/test/lux/math/constructive.lux index 715a9a60c..86f8b7360 100644 --- a/stdlib/test/test/lux/math/constructive.lux +++ b/stdlib/test/test/lux/math/constructive.lux @@ -25,7 +25,7 @@ (theorem: #export [t] (is {reference t} {sample t}) (Test (equality reference sample)) - (.if (.is reference sample) + (.if (.is? reference sample) (#_.True (.let [the-axiom (axiom "is")] the-axiom)) (#_.False absurdity))) -- cgit v1.2.3