From 3afb16f8acf3f1da0b4b4663c9fcf734ce315381 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 15 Sep 2019 04:54:14 -0400 Subject: Got the tests running again. --- stdlib/source/test/lux/data/format/json.lux | 7 ++----- stdlib/source/test/lux/host.jvm.lux | 24 +++++++++++++---------- stdlib/source/test/lux/macro.lux | 3 +-- stdlib/source/test/lux/macro/poly/equivalence.lux | 8 ++++---- stdlib/source/test/lux/macro/poly/functor.lux | 12 +++++++----- stdlib/source/test/lux/macro/poly/json.lux | 16 +++++++-------- stdlib/source/test/lux/target/jvm.lux | 6 ++++-- 7 files changed, 40 insertions(+), 36 deletions(-) (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 6f16a0088..686edae01 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -25,9 +25,7 @@ ["d" dictionary] ["." list]]] [macro - [poly (#+ derived:)] - ["." poly/equivalence] - ["." poly/json]] + [poly (#+ derived:)]] [type ["." unit]] [math @@ -44,8 +42,7 @@ ## ["_." duration] ["_." date]]]] {1 - ["." / (#+ JSON)]} - ) + ["." / (#+ JSON)]}) (def: #export json (Random JSON) diff --git a/stdlib/source/test/lux/host.jvm.lux b/stdlib/source/test/lux/host.jvm.lux index 8ff26e2e9..2bba4c4a7 100644 --- a/stdlib/source/test/lux/host.jvm.lux +++ b/stdlib/source/test/lux/host.jvm.lux @@ -16,6 +16,8 @@ (import: #long (java/util/concurrent/Callable a)) +(import: #long java/lang/Long) + (import: #long java/lang/String) (import: #long java/lang/Exception @@ -66,8 +68,8 @@ [] (call self) a #throws [java/lang/Exception] (undefined)))) -(interface: TestInterface - ([] foo [boolean java/lang/String] void #throws [java/lang/Exception])) +## (interface: TestInterface +## ([] foo [boolean java/lang/String] void #throws [java/lang/Exception])) (def: conversions Test @@ -76,9 +78,9 @@ (`` ($_ _.and (~~ (template [ ] [(_.test - (or (|> sample (i.= sample)) - (let [capped-sample (|> sample )] - (|> capped-sample (i.= capped-sample)))))] + (or (|> sample (:coerce java/lang/Long) (:coerce Int) (i.= sample)) + (let [capped-sample (|> sample (:coerce java/lang/Long) )] + (|> capped-sample (:coerce Int) (i.= (:coerce Int capped-sample))))))] [/.long-to-byte /.byte-to-long "Can succesfully convert to/from byte."] [/.long-to-short /.short-to-long "Can succesfully convert to/from short."] @@ -92,7 +94,8 @@ (def: miscellaneous Test (do r.monad - [sample (r.ascii 1)] + [sample (:: @ map (|>> (:coerce java/lang/Object )) + (r.ascii 1))] ($_ _.and (_.test "Can check if an object is of a certain class." (and (case (/.check java/lang/String sample) (#.Some _) true #.None false) @@ -124,15 +127,16 @@ (do r.monad [size (|> r.nat (:: @ map (|>> (n.% 100) (n.max 1)))) idx (|> r.nat (:: @ map (n.% size))) - value r.int] + value (:: @ map (|>> (:coerce java/lang/Long)) r.int)] ($_ _.and (_.test "Can create arrays of some length." - (n.= size (/.array-length (/.array Long size)))) + (n.= size (/.array-length (/.array java/lang/Long size)))) (_.test "Can set and get array values." - (let [arr (/.array Long size)] + (let [arr (/.array java/lang/Long size)] (exec (/.array-write idx value arr) - (i.= value (/.array-read idx arr)))))))) + (i.= (:coerce Int value) + (:coerce Int (/.array-read idx arr))))))))) (def: #export test ($_ _.and diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux index bc5ed349c..6d65a8c3f 100644 --- a/stdlib/source/test/lux/macro.lux +++ b/stdlib/source/test/lux/macro.lux @@ -12,8 +12,7 @@ ["#." poly #_ ["#/." equivalence] ["#/." functor] - ["#/." json]] - ]) + ["#/." json]]]) (def: #export test Test diff --git a/stdlib/source/test/lux/macro/poly/equivalence.lux b/stdlib/source/test/lux/macro/poly/equivalence.lux index 7b9d0b97c..7ba3bbd13 100644 --- a/stdlib/source/test/lux/macro/poly/equivalence.lux +++ b/stdlib/source/test/lux/macro/poly/equivalence.lux @@ -6,7 +6,9 @@ ["." random (#+ Random)]] [abstract [monad (#+ do)] - [equivalence (#+ Equivalence)]] + [equivalence (#+ Equivalence) + {[0 #poly] + ["." /]}]] [data ["." bit] ["." maybe] @@ -17,9 +19,7 @@ [collection ["." list]]] ["." macro - [poly (#+ derived:)]]] - {1 - ["." /]}) + [poly (#+ derived:)]]]) (type: Variant (#Case0 Bit) diff --git a/stdlib/source/test/lux/macro/poly/functor.lux b/stdlib/source/test/lux/macro/poly/functor.lux index 4eb05af3c..85d24bc5b 100644 --- a/stdlib/source/test/lux/macro/poly/functor.lux +++ b/stdlib/source/test/lux/macro/poly/functor.lux @@ -1,7 +1,11 @@ (.module: [lux #* ["%" data/text/format (#+ format)] - [abstract/monad (#+ do)] + [abstract + [monad (#+ do)] + [functor + {[0 #poly] + ["." /]}]] ["r" math/random (#+ Random)] ["_" test (#+ Test)] [control @@ -9,9 +13,7 @@ [data ["." identity]] [macro - [poly (#+ derived:)]]] - {1 - ["." /]}) + [poly (#+ derived:)]]]) (derived: maybe-functor (/.functor .Maybe)) (derived: list-functor (/.functor .List)) @@ -22,4 +24,4 @@ Test (<| (_.context (%.name (name-of /._))) (_.test "Can derive functors automatically." - #1))) + true))) diff --git a/stdlib/source/test/lux/macro/poly/json.lux b/stdlib/source/test/lux/macro/poly/json.lux index 8a72e0e2b..92a8ce00c 100644 --- a/stdlib/source/test/lux/macro/poly/json.lux +++ b/stdlib/source/test/lux/macro/poly/json.lux @@ -5,7 +5,9 @@ [abstract codec [monad (#+ do)] - [equivalence (#+ Equivalence)] + [equivalence (#+ Equivalence) + {[0 #poly] + ["poly/equivalence" /]}] {[0 #test] [/ ["$." equivalence] @@ -23,14 +25,15 @@ ["n" nat] ["." frac]] [format - [json (#+)]] + [json (#+) + {[0 #poly] + ["." /]}]] [collection [row (#+ row)] ["d" dictionary] ["." list]]] [macro - [poly (#+ derived:)] - ["." poly/equivalence]] + [poly (#+ derived:)]] [type ["." unit]] [math @@ -45,10 +48,7 @@ [time ["_." instant] ## ["_." duration] - ["_." date]]]] - {1 - ["." /]} - ) + ["_." date]]]]) (type: Variant (#Bit Bit) diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index 9437fb38a..fc7c140b4 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -30,7 +30,6 @@ ["." / #_ ["#." loader (#+ Library)] ["#." version] - ["#." descriptor (#+ Descriptor Value)] ["#." modifier ("#@." monoid)] ["#." field] ["#." method] @@ -42,7 +41,10 @@ [encoding ["#." name]] ["#." instruction - ["#/." condition (#+ Environment)]]]}) + ["#/." condition (#+ Environment)]] + [type + [category (#+ Value)] + ["#." descriptor (#+ Descriptor)]]]}) ## (def: (write-class! name bytecode) ## (-> Text Binary (IO Text)) -- cgit v1.2.3