From 42248854f0cb5e3364e6aae25527cee65cbda3e8 Mon Sep 17 00:00:00 2001
From: Eduardo Julian
Date: Tue, 16 Apr 2019 18:47:13 -0400
Subject: The old compiler is now identified with "old" instead of "jvm". This
 should help to get old JVM code and new JVM code to coexist without forcing a
 major rewrite of old compiler code to get it to fit the style of the new JVM
 compiler code.

---
 stdlib/source/test/lux/host.jvm.lux     | 134 --------------------------------
 stdlib/source/test/lux/host.old.lux     | 134 ++++++++++++++++++++++++++++++++
 stdlib/source/test/lux/host/jvm.jvm.lux |  89 ---------------------
 stdlib/source/test/lux/host/jvm.old.lux |  89 +++++++++++++++++++++
 4 files changed, 223 insertions(+), 223 deletions(-)
 delete mode 100644 stdlib/source/test/lux/host.jvm.lux
 create mode 100644 stdlib/source/test/lux/host.old.lux
 delete mode 100644 stdlib/source/test/lux/host/jvm.jvm.lux
 create mode 100644 stdlib/source/test/lux/host/jvm.old.lux

(limited to 'stdlib/source/test')

diff --git a/stdlib/source/test/lux/host.jvm.lux b/stdlib/source/test/lux/host.jvm.lux
deleted file mode 100644
index 04c149881..000000000
--- a/stdlib/source/test/lux/host.jvm.lux
+++ /dev/null
@@ -1,134 +0,0 @@
-(.module:
-  [lux #*
-   [abstract/monad (#+ Monad do)]
-   [control
-    pipe]
-   [data
-    ["." text ("#;." equivalence)]]
-   [math
-    ["r" random]]
-   ["_" test (#+ Test)]]
-  {1
-   ["." / (#+ import: class: interface: object)]})
-
-(import: (java/util/concurrent/Callable a))
-
-(import: java/lang/Exception
-  (new [String]))
-
-(import: java/lang/Object)
-
-(import: (java/lang/Class a)
-  (getName [] String))
-
-(import: java/lang/System
-  (#static out java/io/PrintStream)
-  (#static currentTimeMillis [] #io long)
-  (#static getenv [String] #io #? String))
-
-(class: #final (TestClass A) [Runnable]
-  ## Fields
-  (#private foo boolean)
-  (#private bar A)
-  (#private baz java/lang/Object)
-  ## Methods
-  (#public [] (new {value A}) []
-           (exec (:= ::foo #1)
-             (:= ::bar value)
-             (:= ::baz "")
-             []))
-  (#public (virtual) java/lang/Object
-           "")
-  (#public #static (static) java/lang/Object
-           "")
-  (Runnable [] (run) void
-            []))
-
-(def: test-runnable
-  (object [] [Runnable]
-    []
-    (Runnable [] (run) void
-              [])))
-
-(def: test-callable
-  (object [a] [(Callable a)]
-    []
-    (Callable [] (call) a
-              (undefined))))
-
-(interface: TestInterface
-  ([] foo [boolean String] void #throws [Exception]))
-
-(def: conversions
-  Test
-  (do r.monad
-    [sample r.int]
-    (`` ($_ _.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)))))]
-
-                  [/.long-to-byte /.byte-to-long "Can succesfully convert to/from byte."]
-                  [/.long-to-short /.short-to-long "Can succesfully convert to/from short."]
-                  [/.long-to-int /.int-to-long "Can succesfully convert to/from int."]
-                  [/.long-to-float /.float-to-long "Can succesfully convert to/from float."]
-                  [/.long-to-double /.double-to-long "Can succesfully convert to/from double."]
-                  [(<| /.int-to-char /.long-to-int) (<| /.int-to-long /.char-to-int) "Can succesfully convert to/from char."]
-                  ))
-            ))))
-
-(def: miscellaneous
-  Test
-  (do r.monad
-    [sample (r.ascii 1)]
-    ($_ _.and
-        (_.test "Can check if an object is of a certain class."
-                (and (case (/.check String sample) (#.Some _) true #.None false)
-                     (case (/.check Long sample) (#.Some _) false #.None true)
-                     (case (/.check Object sample) (#.Some _) true #.None false)
-                     (case (/.check Object (/.null)) (#.Some _) false #.None true)))
-
-        (_.test "Can run code in a 'synchronized' block."
-                (/.synchronized sample #1))
-
-        (_.test "Can access Class instances."
-                (text;= "java.lang.Class" (Class::getName (/.class-for java/lang/Class))))
-
-        (_.test "Can check if a value is null."
-                (and (/.null? (/.null))
-                     (not (/.null? sample))))
-
-        (_.test "Can safely convert nullable references into Maybe values."
-                (and (|> (: (Maybe Object) (/.??? (/.null)))
-                         (case> #.None #1
-                                _ #0))
-                     (|> (: (Maybe Object) (/.??? sample))
-                         (case> (#.Some _) #1
-                                _ #0))))
-        )))
-
-(def: arrays
-  Test
-  (do r.monad
-    [size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 1))))
-     idx (|> r.nat (:: @ map (n/% size)))
-     value r.int]
-    ($_ _.and
-        (_.test "Can create arrays of some length."
-                (n/= size (/.array-length (/.array Long size))))
-
-        (_.test "Can set and get array values."
-                (let [arr (/.array Long size)]
-                  (exec (/.array-write idx value arr)
-                    (i/= value (/.array-read idx arr))))))))
-
-(def: #export test
-  ($_ _.and
-      (<| (_.context "Conversions.")
-          ..conversions)
-      (<| (_.context "Miscellaneous.")
-          ..miscellaneous)
-      (<| (_.context "Arrays.")
-          ..arrays)))
diff --git a/stdlib/source/test/lux/host.old.lux b/stdlib/source/test/lux/host.old.lux
new file mode 100644
index 000000000..04c149881
--- /dev/null
+++ b/stdlib/source/test/lux/host.old.lux
@@ -0,0 +1,134 @@
+(.module:
+  [lux #*
+   [abstract/monad (#+ Monad do)]
+   [control
+    pipe]
+   [data
+    ["." text ("#;." equivalence)]]
+   [math
+    ["r" random]]
+   ["_" test (#+ Test)]]
+  {1
+   ["." / (#+ import: class: interface: object)]})
+
+(import: (java/util/concurrent/Callable a))
+
+(import: java/lang/Exception
+  (new [String]))
+
+(import: java/lang/Object)
+
+(import: (java/lang/Class a)
+  (getName [] String))
+
+(import: java/lang/System
+  (#static out java/io/PrintStream)
+  (#static currentTimeMillis [] #io long)
+  (#static getenv [String] #io #? String))
+
+(class: #final (TestClass A) [Runnable]
+  ## Fields
+  (#private foo boolean)
+  (#private bar A)
+  (#private baz java/lang/Object)
+  ## Methods
+  (#public [] (new {value A}) []
+           (exec (:= ::foo #1)
+             (:= ::bar value)
+             (:= ::baz "")
+             []))
+  (#public (virtual) java/lang/Object
+           "")
+  (#public #static (static) java/lang/Object
+           "")
+  (Runnable [] (run) void
+            []))
+
+(def: test-runnable
+  (object [] [Runnable]
+    []
+    (Runnable [] (run) void
+              [])))
+
+(def: test-callable
+  (object [a] [(Callable a)]
+    []
+    (Callable [] (call) a
+              (undefined))))
+
+(interface: TestInterface
+  ([] foo [boolean String] void #throws [Exception]))
+
+(def: conversions
+  Test
+  (do r.monad
+    [sample r.int]
+    (`` ($_ _.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)))))]
+
+                  [/.long-to-byte /.byte-to-long "Can succesfully convert to/from byte."]
+                  [/.long-to-short /.short-to-long "Can succesfully convert to/from short."]
+                  [/.long-to-int /.int-to-long "Can succesfully convert to/from int."]
+                  [/.long-to-float /.float-to-long "Can succesfully convert to/from float."]
+                  [/.long-to-double /.double-to-long "Can succesfully convert to/from double."]
+                  [(<| /.int-to-char /.long-to-int) (<| /.int-to-long /.char-to-int) "Can succesfully convert to/from char."]
+                  ))
+            ))))
+
+(def: miscellaneous
+  Test
+  (do r.monad
+    [sample (r.ascii 1)]
+    ($_ _.and
+        (_.test "Can check if an object is of a certain class."
+                (and (case (/.check String sample) (#.Some _) true #.None false)
+                     (case (/.check Long sample) (#.Some _) false #.None true)
+                     (case (/.check Object sample) (#.Some _) true #.None false)
+                     (case (/.check Object (/.null)) (#.Some _) false #.None true)))
+
+        (_.test "Can run code in a 'synchronized' block."
+                (/.synchronized sample #1))
+
+        (_.test "Can access Class instances."
+                (text;= "java.lang.Class" (Class::getName (/.class-for java/lang/Class))))
+
+        (_.test "Can check if a value is null."
+                (and (/.null? (/.null))
+                     (not (/.null? sample))))
+
+        (_.test "Can safely convert nullable references into Maybe values."
+                (and (|> (: (Maybe Object) (/.??? (/.null)))
+                         (case> #.None #1
+                                _ #0))
+                     (|> (: (Maybe Object) (/.??? sample))
+                         (case> (#.Some _) #1
+                                _ #0))))
+        )))
+
+(def: arrays
+  Test
+  (do r.monad
+    [size (|> r.nat (:: @ map (|>> (n/% 100) (n/max 1))))
+     idx (|> r.nat (:: @ map (n/% size)))
+     value r.int]
+    ($_ _.and
+        (_.test "Can create arrays of some length."
+                (n/= size (/.array-length (/.array Long size))))
+
+        (_.test "Can set and get array values."
+                (let [arr (/.array Long size)]
+                  (exec (/.array-write idx value arr)
+                    (i/= value (/.array-read idx arr))))))))
+
+(def: #export test
+  ($_ _.and
+      (<| (_.context "Conversions.")
+          ..conversions)
+      (<| (_.context "Miscellaneous.")
+          ..miscellaneous)
+      (<| (_.context "Arrays.")
+          ..arrays)))
diff --git a/stdlib/source/test/lux/host/jvm.jvm.lux b/stdlib/source/test/lux/host/jvm.jvm.lux
deleted file mode 100644
index 47c6f35d9..000000000
--- a/stdlib/source/test/lux/host/jvm.jvm.lux
+++ /dev/null
@@ -1,89 +0,0 @@
-(.module:
-  [lux #*
-   [abstract/monad (#+ do)]
-   [control
-    ["." io (#+ IO)]
-    [concurrency
-     ["." atom]]
-    [security
-     ["!" capability]]]
-   [data
-    ["." error (#+ Error)]
-    ["." text
-     format]
-    [format
-     ["." binary]]
-    [collection
-     ["." dictionary]
-     ["." row]]]
-   [world
-    ["." file (#+ File)]
-    [binary (#+ Binary)]]
-   [math
-    ["r" random]]
-   ["_" test (#+ Test)]]
-  {1
-   ["." / #_
-    ["#." loader (#+ Library)]
-    ["#." version]
-    ["#." name]
-    ["#." descriptor]
-    ["#." field]
-    ["#." class]
-    [modifier
-     ["#.M" inner]]]})
-
-(def: (write-class! name bytecode)
-  (-> Text Binary (IO Text))
-  (let [file-path (format name ".class")]
-    (do io.monad
-      [outcome (do (error.with @)
-                 [file (: (IO (Error (File IO)))
-                          (file.get-file io.monad file.system file-path))]
-                 (!.use (:: file over-write) bytecode))]
-      (wrap (case outcome
-              (#error.Success definition)
-              (format "Wrote: " (%t file-path))
-              
-              (#error.Failure error)
-              error)))))
-
-(def: class
-  Test
-  (do r.monad
-    [_ (wrap [])
-     #let [package "my.package"
-           name "MyClass"
-           full-name (format package "." name)
-           input (/class.class /version.v6_0 /class.public
-                               (/name.internal "java.lang.Object")
-                               (/name.internal full-name)
-                               (list (/name.internal "java.io.Serializable")
-                                     (/name.internal "java.lang.Runnable"))
-                               (list (/field.field /field.public "foo" /descriptor.long (row.row))
-                                     (/field.field /field.public "bar" /descriptor.double (row.row)))
-                               (row.row)
-                               (row.row))
-           bytecode (binary.write /class.format input)
-           loader (/loader.memory (/loader.new-library []))]]
-    ($_ _.and
-        (_.test "Can read a generated class."
-                (case (binary.read /class.format bytecode)
-                  (#error.Success output)
-                  (:: /class.equivalence = input output)
-                  
-                  (#error.Failure error)
-                  false))
-        (_.test "Can generate a class."
-                (case (/loader.define full-name bytecode loader)
-                  (#error.Success definition)
-                  true
-                  
-                  (#error.Failure error)
-                  false))
-        )))
-
-(def: #export test
-  Test
-  (<| (_.context "Class")
-      ..class))
diff --git a/stdlib/source/test/lux/host/jvm.old.lux b/stdlib/source/test/lux/host/jvm.old.lux
new file mode 100644
index 000000000..47c6f35d9
--- /dev/null
+++ b/stdlib/source/test/lux/host/jvm.old.lux
@@ -0,0 +1,89 @@
+(.module:
+  [lux #*
+   [abstract/monad (#+ do)]
+   [control
+    ["." io (#+ IO)]
+    [concurrency
+     ["." atom]]
+    [security
+     ["!" capability]]]
+   [data
+    ["." error (#+ Error)]
+    ["." text
+     format]
+    [format
+     ["." binary]]
+    [collection
+     ["." dictionary]
+     ["." row]]]
+   [world
+    ["." file (#+ File)]
+    [binary (#+ Binary)]]
+   [math
+    ["r" random]]
+   ["_" test (#+ Test)]]
+  {1
+   ["." / #_
+    ["#." loader (#+ Library)]
+    ["#." version]
+    ["#." name]
+    ["#." descriptor]
+    ["#." field]
+    ["#." class]
+    [modifier
+     ["#.M" inner]]]})
+
+(def: (write-class! name bytecode)
+  (-> Text Binary (IO Text))
+  (let [file-path (format name ".class")]
+    (do io.monad
+      [outcome (do (error.with @)
+                 [file (: (IO (Error (File IO)))
+                          (file.get-file io.monad file.system file-path))]
+                 (!.use (:: file over-write) bytecode))]
+      (wrap (case outcome
+              (#error.Success definition)
+              (format "Wrote: " (%t file-path))
+              
+              (#error.Failure error)
+              error)))))
+
+(def: class
+  Test
+  (do r.monad
+    [_ (wrap [])
+     #let [package "my.package"
+           name "MyClass"
+           full-name (format package "." name)
+           input (/class.class /version.v6_0 /class.public
+                               (/name.internal "java.lang.Object")
+                               (/name.internal full-name)
+                               (list (/name.internal "java.io.Serializable")
+                                     (/name.internal "java.lang.Runnable"))
+                               (list (/field.field /field.public "foo" /descriptor.long (row.row))
+                                     (/field.field /field.public "bar" /descriptor.double (row.row)))
+                               (row.row)
+                               (row.row))
+           bytecode (binary.write /class.format input)
+           loader (/loader.memory (/loader.new-library []))]]
+    ($_ _.and
+        (_.test "Can read a generated class."
+                (case (binary.read /class.format bytecode)
+                  (#error.Success output)
+                  (:: /class.equivalence = input output)
+                  
+                  (#error.Failure error)
+                  false))
+        (_.test "Can generate a class."
+                (case (/loader.define full-name bytecode loader)
+                  (#error.Success definition)
+                  true
+                  
+                  (#error.Failure error)
+                  false))
+        )))
+
+(def: #export test
+  Test
+  (<| (_.context "Class")
+      ..class))
-- 
cgit v1.2.3