aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/target/ruby.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/target/ruby.lux')
-rw-r--r--stdlib/source/test/lux/target/ruby.lux59
1 files changed, 55 insertions, 4 deletions
diff --git a/stdlib/source/test/lux/target/ruby.lux b/stdlib/source/test/lux/target/ruby.lux
index 87e781ebc..86a817703 100644
--- a/stdlib/source/test/lux/target/ruby.lux
+++ b/stdlib/source/test/lux/target/ruby.lux
@@ -11,7 +11,8 @@
["[0]" try {"+" Try} ("[1]#[0]" functor)]]
[data
["[0]" bit ("[1]#[0]" equivalence)]
- ["[0]" text ("[1]#[0]" equivalence)]
+ ["[0]" text ("[1]#[0]" equivalence)
+ ["%" format {"+" format}]]
[collection
["[0]" list ("[1]#[0]" functor)]]]
["[0]" math
@@ -20,7 +21,14 @@
["n" nat]
["i" int]
["f" frac]
- ["[0]" i64]]]]]
+ ["[0]" i64]]]
+ [tool
+ [compiler
+ [meta
+ ["[0]" packager "_"
+ ["[1]" ruby]]]]]
+ [world
+ ["[0]" file]]]]
[\\library
["[0]" /]])
@@ -580,15 +588,58 @@
..test/location)
)))
+(def: test|global
+ Test
+ ($_ _.and
+ (_.cover [/.script_name]
+ (expression (let [file (format (# file.default separator) packager.main_file)]
+ (|>> (:as Text)
+ (predicate.or (text.ends_with? file)
+ (text#= "<script>"))))
+ /.script_name))
+ (_.cover [/.input_record_separator]
+ (expression (|>> (:as Text)
+ (text#= text.\n))
+ /.input_record_separator))
+ (_.cover [/.output_record_separator]
+ (|> /.output_record_separator
+ /.code
+ ..eval
+ (try#each (function (_ it)
+ (case it
+ {.#None} true
+ {.#Some _} false)))
+ (try.else false)))
+ ))
+
+(def: random_expression
+ (Random /.Expression)
+ (let [literal (: (Random /.Literal)
+ ($_ random.either
+ (random#each /.bool random.bit)
+ (random#each /.float random.frac)
+ (random#each /.int random.int)
+ (random#each /.string (random.ascii/lower 5))
+ ))]
+ ($_ random.either
+ literal
+ )))
+
(def: .public test
Test
(do [! random.monad]
- []
+ [expected ..random_expression]
(<| (_.covering /._)
- (_.for [/.Code /.code])
+ (_.for [/.Code])
($_ _.and
+ (_.cover [/.code /.manual]
+ (|> (/.manual (/.code expected))
+ (: /.Expression)
+ (# /.code_equivalence = expected)))
(_.for [/.Expression]
..test|expression)
(_.for [/.Statement]
..test|statement)
+ (_.for [/.GVar]
+ ..test|global)
))))