aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/test
diff options
context:
space:
mode:
authorEduardo Julian2018-03-13 23:28:19 -0400
committerEduardo Julian2018-03-13 23:28:19 -0400
commitb14f95ca68887d9e6cea211b47e04e5ec00c05fa (patch)
tree4fad118bec9800bfae885dcb6311e8755b98918a /new-luxc/test
parent38bd6f35d81705ab0c04c85601ac5b236b62605a (diff)
- Initial Ruby back-end implementation.
Diffstat (limited to '')
-rw-r--r--new-luxc/test/test/luxc/common.lux10
-rw-r--r--new-luxc/test/test/luxc/lang/translation/case.lux11
-rw-r--r--new-luxc/test/test/luxc/lang/translation/common.lux10
-rw-r--r--new-luxc/test/test/luxc/lang/translation/function.lux19
-rw-r--r--new-luxc/test/test/luxc/lang/translation/primitive.lux4
-rw-r--r--new-luxc/test/test/luxc/lang/translation/reference.lux56
-rw-r--r--new-luxc/test/test/luxc/lang/translation/structure.lux28
-rw-r--r--new-luxc/test/tests.lux9
8 files changed, 100 insertions, 47 deletions
diff --git a/new-luxc/test/test/luxc/common.lux b/new-luxc/test/test/luxc/common.lux
index cc8302aa3..5021dc258 100644
--- a/new-luxc/test/test/luxc/common.lux
+++ b/new-luxc/test/test/luxc/common.lux
@@ -18,7 +18,12 @@
[lua]
(lua [".T_lua" expression]
[".T_lua" eval]
- [".T_lua" runtime])))))
+ [".T_lua" runtime])
+
+ [ruby]
+ (ruby [".T_ruby" expression]
+ [".T_ruby" eval]
+ [".T_ruby" runtime])))))
(do-template [<name> <host>]
[(def: #export <name>
@@ -30,6 +35,7 @@
[init-jvm &host.init-host]
[init-js js.init]
[init-lua lua.init]
+ [init-ruby ruby.init]
)
(def: (run-synthesis translate-runtime translate-expression eval init)
@@ -48,3 +54,5 @@
(def: #export run-js (run-synthesis runtimeT_js.translate expressionT_js.translate evalT_js.eval init-js))
(def: #export run-lua (run-synthesis runtimeT_lua.translate expressionT_lua.translate evalT_lua.eval init-lua))
+
+(def: #export run-ruby (run-synthesis runtimeT_ruby.translate expressionT_ruby.translate evalT_ruby.eval init-ruby))
diff --git a/new-luxc/test/test/luxc/lang/translation/case.lux b/new-luxc/test/test/luxc/lang/translation/case.lux
index e2ad48613..cc33d03d3 100644
--- a/new-luxc/test/test/luxc/lang/translation/case.lux
+++ b/new-luxc/test/test/luxc/lang/translation/case.lux
@@ -23,7 +23,11 @@
(lua ["/_lua" case]
[".T_lua" expression]
[".T_lua" eval]
- [".T_lua" runtime]))))
+ [".T_lua" runtime])
+ (ruby ["/_ruby" case]
+ [".T_ruby" expression]
+ [".T_ruby" eval]
+ [".T_ruby" runtime]))))
(test/luxc common))
(def: struct-limit Nat +10)
@@ -132,3 +136,8 @@
(<| (times +100)
(pattern-matching-spec expressionT_lua.translate evalT_lua.eval runtimeT_lua.translate init-lua
/_lua.translate-case)))
+
+(context: "[Ruby] Pattern-matching."
+ (<| (times +100)
+ (pattern-matching-spec expressionT_ruby.translate evalT_ruby.eval runtimeT_ruby.translate init-ruby
+ /_ruby.translate-case)))
diff --git a/new-luxc/test/test/luxc/lang/translation/common.lux b/new-luxc/test/test/luxc/lang/translation/common.lux
index 2f735a0d1..72dbeb1da 100644
--- a/new-luxc/test/test/luxc/lang/translation/common.lux
+++ b/new-luxc/test/test/luxc/lang/translation/common.lux
@@ -26,7 +26,10 @@
[".T_js" runtime])
(lua [".T_lua" eval]
[".T_lua" expression]
- [".T_lua" runtime]))))
+ [".T_lua" runtime])
+ (ruby [".T_ruby" eval]
+ [".T_ruby" expression]
+ [".T_ruby" runtime]))))
(test/luxc common))
(def: (bit-spec translate-expression eval translate-runtime init)
@@ -832,3 +835,8 @@
(<| (times +100)
(all-specs expressionT_lua.translate evalT_lua.eval runtimeT_lua.translate init-lua
run-lua)))
+
+(context: "[Ruby] Common procedures."
+ (<| (times +100)
+ (all-specs expressionT_ruby.translate evalT_ruby.eval runtimeT_ruby.translate init-ruby
+ run-ruby)))
diff --git a/new-luxc/test/test/luxc/lang/translation/function.lux b/new-luxc/test/test/luxc/lang/translation/function.lux
index cbf8b3dbd..c25632916 100644
--- a/new-luxc/test/test/luxc/lang/translation/function.lux
+++ b/new-luxc/test/test/luxc/lang/translation/function.lux
@@ -6,6 +6,7 @@
(data [product]
[maybe]
["e" error]
+ text/format
(coll ["a" array]
[list "list/" Functor<List>]))
["r" math/random "r/" Monad<Random>]
@@ -23,7 +24,10 @@
[".T_js" runtime])
(lua [".T_lua" eval]
[".T_lua" expression]
- [".T_lua" runtime]))))
+ [".T_lua" runtime])
+ (ruby [".T_ruby" eval]
+ [".T_ruby" expression]
+ [".T_ruby" runtime]))))
(test/luxc common))
(def: arity-limit Nat +10)
@@ -65,7 +69,8 @@
(n/= arg-value (:! Nat valueT))
(#e.Error error)
- false)))
+ (exec (log! error)
+ false))))
(test "Can partially apply functions."
(or (n/= +1 arity)
(|> (do macro.Monad<Meta>
@@ -83,7 +88,8 @@
(n/= arg-value (:! Nat valueT))
(#e.Error error)
- false))))
+ (exec (log! error)
+ false)))))
(test "Can read environment."
(or (n/= +1 arity)
(|> (do macro.Monad<Meta>
@@ -106,7 +112,8 @@
(n/= arg-value (:! Nat valueT))
(#e.Error error)
- false))))
+ (exec (log! error)
+ false)))))
)))
(context: "[JVM] Function."
@@ -120,3 +127,7 @@
(context: "[Lua] Function."
(<| (times +100)
(function-spec expressionT_lua.translate evalT_lua.eval runtimeT_lua.translate init-lua)))
+
+(context: "[Ruby] Function."
+ (<| (times +100)
+ (function-spec expressionT_ruby.translate evalT_ruby.eval runtimeT_ruby.translate init-ruby)))
diff --git a/new-luxc/test/test/luxc/lang/translation/primitive.lux b/new-luxc/test/test/luxc/lang/translation/primitive.lux
index d94806601..8dc48db6f 100644
--- a/new-luxc/test/test/luxc/lang/translation/primitive.lux
+++ b/new-luxc/test/test/luxc/lang/translation/primitive.lux
@@ -61,3 +61,7 @@
(context: "[Lua] Primitives."
(<| (times +100)
(spec run-lua)))
+
+(context: "[Ruby] Primitives."
+ (<| (times +100)
+ (spec run-ruby)))
diff --git a/new-luxc/test/test/luxc/lang/translation/reference.lux b/new-luxc/test/test/luxc/lang/translation/reference.lux
index 130a42ed3..919e35ab2 100644
--- a/new-luxc/test/test/luxc/lang/translation/reference.lux
+++ b/new-luxc/test/test/luxc/lang/translation/reference.lux
@@ -26,7 +26,13 @@
[".T_lua" eval]
[".T_lua" expression]
[".T_lua" case]
- [".T_lua" runtime]))))
+ [".T_lua" runtime])
+ (ruby [".T_ruby" statement]
+ [".T_ruby" eval]
+ [".T_ruby" expression]
+ [".T_ruby" case]
+ [".T_ruby" runtime])
+ )))
(test/luxc common))
(def: upper-alpha-ascii
@@ -97,32 +103,38 @@
false)))
)))
-(context: "[JVM] Definitions."
- (<| (times +100)
- (definitions-spec expressionT_jvm.translate evalT_jvm.eval runtimeT_jvm.translate init-jvm
- statementT_jvm.translate-def)))
-
-(context: "[JVM] Variables."
- (<| (times +100)
- (variables-spec expressionT_jvm.translate evalT_jvm.eval runtimeT_jvm.translate init-jvm
- caseT_jvm.translate-let)))
+(def: (references-spec translate-expression eval translate-runtime init
+ translate-def translate-let)
+ (All [a]
+ (-> (-> ls.Synthesis (Meta a)) (-> a (Meta Top)) (Meta Top) (IO Compiler)
+ (-> Text Type a Code (Meta Unit))
+ (-> (-> ls.Synthesis (Meta a)) Nat ls.Synthesis ls.Synthesis (Meta a))
+ Test))
+ (seq (definitions-spec translate-expression eval translate-runtime init
+ translate-def)
+ (variables-spec translate-expression eval translate-runtime init
+ translate-let)))
-(context: "[JS] Definitions."
+(context: "[JVM] References."
(<| (times +100)
- (definitions-spec expressionT_js.translate evalT_js.eval runtimeT_js.translate init-js
- statementT_js.translate-def)))
+ (references-spec expressionT_jvm.translate evalT_jvm.eval runtimeT_jvm.translate init-jvm
+ statementT_jvm.translate-def
+ caseT_jvm.translate-let)))
-(context: "[JS] Variables."
+(context: "[JS] References."
(<| (times +100)
- (variables-spec expressionT_js.translate evalT_js.eval runtimeT_js.translate init-js
- caseT_js.translate-let)))
+ (references-spec expressionT_js.translate evalT_js.eval runtimeT_js.translate init-js
+ statementT_js.translate-def
+ caseT_js.translate-let)))
-(context: "[Lua] Definitions."
+(context: "[Lua] References."
(<| (times +100)
- (definitions-spec expressionT_lua.translate evalT_lua.eval runtimeT_lua.translate init-lua
- statementT_lua.translate-def)))
+ (references-spec expressionT_lua.translate evalT_lua.eval runtimeT_lua.translate init-lua
+ statementT_lua.translate-def
+ caseT_lua.translate-let)))
-(context: "[Lua] Variables."
+(context: "[Ruby] References."
(<| (times +100)
- (variables-spec expressionT_lua.translate evalT_lua.eval runtimeT_lua.translate init-lua
- caseT_lua.translate-let)))
+ (references-spec expressionT_ruby.translate evalT_ruby.eval runtimeT_ruby.translate init-ruby
+ statementT_ruby.translate-def
+ caseT_ruby.translate-let)))
diff --git a/new-luxc/test/test/luxc/lang/translation/structure.lux b/new-luxc/test/test/luxc/lang/translation/structure.lux
index 21a338196..cf2b8a729 100644
--- a/new-luxc/test/test/luxc/lang/translation/structure.lux
+++ b/new-luxc/test/test/luxc/lang/translation/structure.lux
@@ -106,26 +106,24 @@
(exec (log! error)
false))))))
-(context: "[JVM] Tuples."
- (<| (times +100)
- (tuples-spec run-jvm)))
-
-(context: "[JVM] Variants."
- (<| (times +100)
- (variants-spec run-jvm)))
+(def: (structure-spec run)
+ (-> (-> Synthesis (e.Error Top)) Test)
+ ($_ seq
+ (tuples-spec run)
+ (variants-spec run)))
-(context: "[JS] Tuples."
+(context: "[JVM] Structures."
(<| (times +100)
- (tuples-spec run-js)))
+ (structure-spec run-jvm)))
-(context: "[JS] Variants."
+(context: "[JS] Structures."
(<| (times +100)
- (variants-spec run-js)))
+ (structure-spec run-js)))
-(context: "[Lua] Tuples."
+(context: "[Lua] Structures."
(<| (times +100)
- (tuples-spec run-lua)))
+ (structure-spec run-lua)))
-(context: "[Lua] Variants."
+(context: "[Ruby] Structures."
(<| (times +100)
- (variants-spec run-lua)))
+ (structure-spec run-ruby)))
diff --git a/new-luxc/test/tests.lux b/new-luxc/test/tests.lux
index 9268e492c..886d3d05d 100644
--- a/new-luxc/test/tests.lux
+++ b/new-luxc/test/tests.lux
@@ -20,13 +20,16 @@
["_.S" procedure]
["_.S" loop])
(translation ["_.T" primitive]
- ["_.T" reference]
["_.T" structure]
- ["_.T" case]
["_.T" function]
+ ["_.T" case]
+ ["_.T" reference]
["_.T" common]
["_.T" jvm]
- ["_.T" js]))
+ ["_.T" js]
+ ## ["_.T" lua]
+ ## ["_.T" ruby]
+ ))
)))
(program: args