aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test
diff options
context:
space:
mode:
authorEduardo Julian2019-09-15 04:54:14 -0400
committerEduardo Julian2019-09-15 04:54:14 -0400
commit3afb16f8acf3f1da0b4b4663c9fcf734ce315381 (patch)
treed9d0719b2585fbd060afe00688b1fd7e990e1e0e /stdlib/source/test
parent7027b09b68a5ad8f7a4eb2f9edd913d43d2f1730 (diff)
Got the tests running again.
Diffstat (limited to '')
-rw-r--r--stdlib/source/test/lux/data/format/json.lux7
-rw-r--r--stdlib/source/test/lux/host.jvm.lux24
-rw-r--r--stdlib/source/test/lux/macro.lux3
-rw-r--r--stdlib/source/test/lux/macro/poly/equivalence.lux8
-rw-r--r--stdlib/source/test/lux/macro/poly/functor.lux12
-rw-r--r--stdlib/source/test/lux/macro/poly/json.lux16
-rw-r--r--stdlib/source/test/lux/target/jvm.lux6
7 files changed, 40 insertions, 36 deletions
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 [<to> <from> <message>]
[(_.test <message>
- (or (|> sample <to> <from> (i.= sample))
- (let [capped-sample (|> sample <to> <from>)]
- (|> capped-sample <to> <from> (i.= capped-sample)))))]
+ (or (|> sample (:coerce java/lang/Long) <to> <from> (:coerce Int) (i.= sample))
+ (let [capped-sample (|> sample (:coerce java/lang/Long) <to> <from>)]
+ (|> capped-sample <to> <from> (: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))