From 6cb445ad8bd6c4d3db62250d9626a9a4e228d84d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 28 Dec 2018 23:37:36 -0400 Subject: Added equivalences. --- stdlib/test/test/lux/host/jvm.jvm.lux | 55 ++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 27 deletions(-) (limited to 'stdlib/test') diff --git a/stdlib/test/test/lux/host/jvm.jvm.lux b/stdlib/test/test/lux/host/jvm.jvm.lux index 309deb800..b293c811f 100644 --- a/stdlib/test/test/lux/host/jvm.jvm.lux +++ b/stdlib/test/test/lux/host/jvm.jvm.lux @@ -22,6 +22,7 @@ ["/." loader (#+ Library)] ["/." version] ["/." name] + ["/." descriptor] ["/." field] ["/." class] [modifier @@ -43,42 +44,42 @@ (format "Wrote: " (%t file-path)) (#error.Failure error) - error))))) + ## TODO: Remove 'log!' call. + (exec (log! error) + error)))))) (context: "Class" (let [package "my.package" name "MyClass" full-name (format package "." name) - class (/class.class /version.v6_0 /class.public + 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")) - (row.row) + (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 class) + bytecode (binary.write /class.format input) loader (/loader.memory (/loader.new-library []))] - (exec - ## TODO: Remove 'write-class' call. - (io.run (..write-class name)) - ($_ seq - (test "Can read a generated class." - (case (binary.read /class.format bytecode) - (#error.Success class) - true - - (#error.Failure error) - ## TODO: Remove 'log!' call. - (exec (log! error) - false))) - (test "Can generate a class." - (case (/loader.define full-name bytecode loader) - (#error.Success definition) - true - - (#error.Failure error) - ## TODO: Remove 'log!' call. - (exec (log! error) - false))) - )))) + ($_ seq + (test "Can read a generated class." + (case (binary.read /class.format bytecode) + (#error.Success output) + (:: /class.Equivalence = input output) + + (#error.Failure error) + ## TODO: Remove 'log!' call. + (exec (log! error) + false))) + (test "Can generate a class." + (case (/loader.define full-name bytecode loader) + (#error.Success definition) + true + + (#error.Failure error) + ## TODO: Remove 'log!' call. + (exec (log! error) + false))) + ))) -- cgit v1.2.3