diff options
Diffstat (limited to '')
-rw-r--r-- | new-luxc/test/test/luxc/analyser/procedure/host.jvm.lux | 124 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/common.lux | 2 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/parser.lux | 18 |
3 files changed, 72 insertions, 72 deletions
diff --git a/new-luxc/test/test/luxc/analyser/procedure/host.jvm.lux b/new-luxc/test/test/luxc/analyser/procedure/host.jvm.lux index aa0f2388d..ad5670cbe 100644 --- a/new-luxc/test/test/luxc/analyser/procedure/host.jvm.lux +++ b/new-luxc/test/test/luxc/analyser/procedure/host.jvm.lux @@ -51,7 +51,7 @@ (context: "Conversions [double + float]." (with-expansions [<conversions> (do-template [<procedure> <from> <to>] [(test (format <procedure> " SUCCESS") - (success <procedure> (list (' (_lux_coerce (+0 <from> (+0)) []))) <to>)) + (success <procedure> (list (' ("lux coerce" (+0 <from> (+0)) []))) <to>)) (test (format <procedure> " FAILURE") (failure <procedure> (list (' [])) <to>))] @@ -69,7 +69,7 @@ (context: "Conversions [int]." (with-expansions [<conversions> (do-template [<procedure> <from> <to>] [(test (format <procedure> " SUCCESS") - (success <procedure> (list (' (_lux_coerce (+0 <from> (+0)) []))) <to>)) + (success <procedure> (list (' ("lux coerce" (+0 <from> (+0)) []))) <to>)) (test (format <procedure> " FAILURE") (failure <procedure> (list (' [])) <to>))] @@ -87,7 +87,7 @@ (context: "Conversions [long]." (with-expansions [<conversions> (do-template [<procedure> <from> <to>] [(test (format <procedure> " SUCCESS") - (success <procedure> (list (' (_lux_coerce (+0 <from> (+0)) []))) <to>)) + (success <procedure> (list (' ("lux coerce" (+0 <from> (+0)) []))) <to>)) (test (format <procedure> " FAILURE") (failure <procedure> (list (' [])) <to>))] @@ -104,7 +104,7 @@ (context: "Conversions [char + byte + short]." (with-expansions [<conversions> (do-template [<procedure> <from> <to>] [(test (format <procedure> " SUCCESS") - (success <procedure> (list (' (_lux_coerce (+0 <from> (+0)) []))) <to>)) + (success <procedure> (list (' ("lux coerce" (+0 <from> (+0)) []))) <to>)) (test (format <procedure> " FAILURE") (failure <procedure> (list (' [])) <to>))] @@ -124,8 +124,8 @@ (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> - (list (' (_lux_coerce (+0 <subject> (+0)) [])) - (' (_lux_coerce (+0 <param> (+0)) []))) + (list (' ("lux coerce" (+0 <subject> (+0)) [])) + (' ("lux coerce" (+0 <param> (+0)) []))) <output>))] [(format "jvm " <domain> " +") <boxed> <boxed> <type>] @@ -142,8 +142,8 @@ (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> - (list (' (_lux_coerce (+0 <subject> (+0)) [])) - (' (_lux_coerce (+0 <param> (+0)) []))) + (list (' ("lux coerce" (+0 <subject> (+0)) [])) + (' ("lux coerce" (+0 <param> (+0)) []))) <output>))] [(format "jvm " <domain> " =") <boxed> <boxed> @host;Boolean] @@ -157,8 +157,8 @@ (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> - (list (' (_lux_coerce (+0 <subject> (+0)) [])) - (' (_lux_coerce (+0 <param> (+0)) []))) + (list (' ("lux coerce" (+0 <subject> (+0)) [])) + (' ("lux coerce" (+0 <param> (+0)) []))) <output>))] [(format "jvm " <domain> " and") <boxed> <boxed> <type>] @@ -182,8 +182,8 @@ (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> - (list (' (_lux_coerce (+0 <subject> (+0)) [])) - (' (_lux_coerce (+0 <param> (+0)) []))) + (list (' ("lux coerce" (+0 <subject> (+0)) [])) + (' ("lux coerce" (+0 <param> (+0)) []))) <output>))] [(format "jvm " <domain> " +") <boxed> <boxed> <type>] @@ -200,8 +200,8 @@ (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> - (list (' (_lux_coerce (+0 <subject> (+0)) [])) - (' (_lux_coerce (+0 <param> (+0)) []))) + (list (' ("lux coerce" (+0 <subject> (+0)) [])) + (' ("lux coerce" (+0 <param> (+0)) []))) <output>))] [(format "jvm " <domain> " =") <boxed> <boxed> @host;Boolean] @@ -221,8 +221,8 @@ (with-expansions [<instructions> (do-template [<procedure> <subject> <param> <output>] [(test <procedure> (success <procedure> - (list (' (_lux_coerce (+0 <subject> (+0)) [])) - (' (_lux_coerce (+0 <param> (+0)) []))) + (list (' ("lux coerce" (+0 <subject> (+0)) [])) + (' ("lux coerce" (+0 <param> (+0)) []))) <output>))] [(format "jvm " <domain> " =") <boxed> <boxed> @host;Boolean] @@ -258,8 +258,8 @@ level (|> r;nat (:: @ map cap)) #let [unboxedT (#;Primitive unboxed (list)) arrayT (#;Primitive "#Array" (list unboxedT)) - arrayC (`' (_lux_check (+0 "#Array" (+1 (+0 (~ (code;text unboxed)) (+0)) (+0))) - ("jvm array new" (~ (code;nat size))))) + arrayC (`' ("lux check" (+0 "#Array" (+1 (+0 (~ (code;text unboxed)) (+0)) (+0))) + ("jvm array new" (~ (code;nat size))))) boxedT (#;Primitive boxed (list)) boxedTC (` (+0 (~ (code;text boxed)) (+0))) multi-arrayT (list/fold (function [_ innerT] @@ -289,7 +289,7 @@ boxedT)) (test "jvm array write" (success "jvm array write" - (list arrayC (code;nat idx) (`' (_lux_coerce (~ boxedTC) []))) + (list arrayC (code;nat idx) (`' ("lux coerce" (~ boxedTC) []))) arrayT)) )))) @@ -311,20 +311,20 @@ (r;filter (function [[!unboxed !boxed]] (not (text/= boxed !boxed))))) #let [boxedT (#;Primitive boxed (list)) - boxedC (`' (_lux_check (+0 (~ (code;text boxed)) (+0)) - ("jvm object null"))) - !boxedC (`' (_lux_check (+0 (~ (code;text !boxed)) (+0)) - ("jvm object null"))) - unboxedC (`' (_lux_check (+0 (~ (code;text unboxed)) (+0)) - ("jvm object null")))] + boxedC (`' ("lux check" (+0 (~ (code;text boxed)) (+0)) + ("jvm object null"))) + !boxedC (`' ("lux check" (+0 (~ (code;text !boxed)) (+0)) + ("jvm object null"))) + unboxedC (`' ("lux check" (+0 (~ (code;text unboxed)) (+0)) + ("jvm object null")))] throwable (|> r;nat (:: @ map (n.% (n.inc (list;size throwables)))) (:: @ map (function [idx] (|> throwables (list;nth idx) (maybe;default "java.lang.Object"))))) - #let [throwableC (`' (_lux_check (+0 (~ (code;text throwable)) (+0)) - ("jvm object null")))]] + #let [throwableC (`' ("lux check" (+0 (~ (code;text throwable)) (+0)) + ("jvm object null")))]] ($_ seq (test "jvm object null" (success "jvm object null" @@ -391,22 +391,22 @@ (success "jvm member static put" (list (code;text "java.awt.datatransfer.DataFlavor") (code;text "allHtmlFlavor") - (`' (_lux_check (+0 "java.awt.datatransfer.DataFlavor" (+0)) - ("jvm object null")))) + (`' ("lux check" (+0 "java.awt.datatransfer.DataFlavor" (+0)) + ("jvm object null")))) Unit)) (test "jvm member static put (final)" (failure "jvm member static put" (list (code;text "java.lang.System") (code;text "out") - (`' (_lux_check (+0 "java.io.PrintStream" (+0)) - ("jvm object null")))) + (`' ("lux check" (+0 "java.io.PrintStream" (+0)) + ("jvm object null")))) Unit)) (test "jvm member static put (inheritance in)" (success "jvm member static put" (list (code;text "java.awt.datatransfer.DataFlavor") (code;text "allHtmlFlavor") - (`' (_lux_check (+0 "javax.activation.ActivationDataFlavor" (+0)) - ("jvm object null")))) + (`' ("lux check" (+0 "javax.activation.ActivationDataFlavor" (+0)) + ("jvm object null")))) Unit)) )) @@ -416,42 +416,42 @@ (success "jvm member virtual get" (list (code;text "org.omg.CORBA.ValueMember") (code;text "id") - (`' (_lux_check (+0 "org.omg.CORBA.ValueMember" (+0)) - ("jvm object null")))) + (`' ("lux check" (+0 "org.omg.CORBA.ValueMember" (+0)) + ("jvm object null")))) (#;Primitive "java.lang.String" (list)))) (test "jvm member virtual get (inheritance out)" (success "jvm member virtual get" (list (code;text "org.omg.CORBA.ValueMember") (code;text "id") - (`' (_lux_check (+0 "org.omg.CORBA.ValueMember" (+0)) - ("jvm object null")))) + (`' ("lux check" (+0 "org.omg.CORBA.ValueMember" (+0)) + ("jvm object null")))) (#;Primitive "java.lang.Object" (list)))) (test "jvm member virtual put" (success "jvm member virtual put" (list (code;text "org.omg.CORBA.ValueMember") (code;text "id") - (`' (_lux_check (+0 "java.lang.String" (+0)) - ("jvm object null"))) - (`' (_lux_check (+0 "org.omg.CORBA.ValueMember" (+0)) - ("jvm object null")))) + (`' ("lux check" (+0 "java.lang.String" (+0)) + ("jvm object null"))) + (`' ("lux check" (+0 "org.omg.CORBA.ValueMember" (+0)) + ("jvm object null")))) Unit)) (test "jvm member virtual put (final)" (failure "jvm member virtual put" (list (code;text "javax.swing.text.html.parser.DTD") (code;text "applet") - (`' (_lux_check (+0 "javax.swing.text.html.parser.Element" (+0)) - ("jvm object null"))) - (`' (_lux_check (+0 "javax.swing.text.html.parser.DTD" (+0)) - ("jvm object null")))) + (`' ("lux check" (+0 "javax.swing.text.html.parser.Element" (+0)) + ("jvm object null"))) + (`' ("lux check" (+0 "javax.swing.text.html.parser.DTD" (+0)) + ("jvm object null")))) Unit)) (test "jvm member virtual put (inheritance in)" (success "jvm member virtual put" (list (code;text "java.awt.GridBagConstraints") (code;text "insets") - (`' (_lux_check (+0 "javax.swing.plaf.InsetsUIResource" (+0)) - ("jvm object null"))) - (`' (_lux_check (+0 "java.awt.GridBagConstraints" (+0)) - ("jvm object null")))) + (`' ("lux check" (+0 "javax.swing.plaf.InsetsUIResource" (+0)) + ("jvm object null"))) + (`' ("lux check" (+0 "java.awt.GridBagConstraints" (+0)) + ("jvm object null")))) Unit)) )) @@ -466,35 +466,35 @@ (success "jvm member virtual get" (list (code;text "javax.accessibility.AccessibleAttributeSequence") (code;text "startIndex") - (`' (_lux_check (+0 "javax.accessibility.AccessibleAttributeSequence" (+0)) - ("jvm object null")))) + (`' ("lux check" (+0 "javax.accessibility.AccessibleAttributeSequence" (+0)) + ("jvm object null")))) (#;Primitive "java.lang.Integer" (list)))) (test "jvm member virtual put" (success "jvm member virtual put" (list (code;text "javax.accessibility.AccessibleAttributeSequence") (code;text "startIndex") - (`' (_lux_check (+0 "java.lang.Integer" (+0)) - ("jvm object null"))) - (`' (_lux_check (+0 "javax.accessibility.AccessibleAttributeSequence" (+0)) - ("jvm object null")))) + (`' ("lux check" (+0 "java.lang.Integer" (+0)) + ("jvm object null"))) + (`' ("lux check" (+0 "javax.accessibility.AccessibleAttributeSequence" (+0)) + ("jvm object null")))) Unit)) )) (context: "Member [Method]." - (let [longC (' (_lux_coerce (+0 "java.lang.Long" (+0)) - +123)) + (let [longC (' ("lux coerce" (+0 "java.lang.Long" (+0)) + +123)) intC (`' ("jvm convert long-to-int" (~ longC))) - objectC (`' (_lux_check (+0 "java.util.ArrayList" (+1 (+0 "java.lang.Long" (+0)) (+0))) - ("jvm member invoke constructor" "java.util.ArrayList" - ["int" (~ intC)])))] + objectC (`' ("lux check" (+0 "java.util.ArrayList" (+1 (+0 "java.lang.Long" (+0)) (+0))) + ("jvm member invoke constructor" "java.util.ArrayList" + ["int" (~ intC)])))] ($_ seq (test "jvm member invoke static" (success "jvm member invoke static" (list (code;text "java.lang.Long") (code;text "decode") (code;tuple (list (' "java.lang.String") - (' (_lux_coerce (+0 "java.lang.String" (+0)) - "YOLO"))))) + (' ("lux coerce" (+0 "java.lang.String" (+0)) + "YOLO"))))) (#;Primitive "java.lang.Long" (list)))) (test "jvm member invoke virtual" (success "jvm member invoke virtual" diff --git a/new-luxc/test/test/luxc/common.lux b/new-luxc/test/test/luxc/common.lux index 36e13c2a3..2e725be5d 100644 --- a/new-luxc/test/test/luxc/common.lux +++ b/new-luxc/test/test/luxc/common.lux @@ -25,7 +25,7 @@ (def: #export (init-compiler _) (-> Top Compiler) {#;info init-info - #;source [dummy-cursor ""] + #;source [dummy-cursor +0 ""] #;cursor dummy-cursor #;modules (list) #;scopes (list) diff --git a/new-luxc/test/test/luxc/parser.lux b/new-luxc/test/test/luxc/parser.lux index 576a48ea3..0f2fd2dd1 100644 --- a/new-luxc/test/test/luxc/parser.lux +++ b/new-luxc/test/test/luxc/parser.lux @@ -79,7 +79,7 @@ (do @ [sample code^] (test "Can parse Lux code." - (case (&;parse [default-cursor (code;to-text sample)]) + (case (&;parse [default-cursor +0 (code;to-text sample)]) (#e;Error error) false @@ -99,7 +99,7 @@ signed? r;bool #let [expected (|> numerator (f./ denominator) (f.* (if signed? -1.0 1.0)))]] (test "Can parse frac ratio syntax." - (case (&;parse [default-cursor + (case (&;parse [default-cursor +0 (format (if signed? "-" "") (%i (frac-to-int numerator)) "/" @@ -117,7 +117,7 @@ (do @ [expected (|> r;nat (:: @ map (n.% +1_000)))] (test "Can parse nat char syntax." - (case (&;parse [default-cursor + (case (&;parse [default-cursor +0 (format "#\"" (text;from-code expected) "\"")]) (#e;Success [_ [_ (#;Nat actual)]]) (n.= expected actual) @@ -168,7 +168,7 @@ (let [bad-match (format (text;from-code x) "\n" (text;from-code y) "\n" (text;from-code z))] - (case (&;parse [default-cursor + (case (&;parse [default-cursor +0 (format "\"" bad-match "\"")]) (#e;Error error) true @@ -182,8 +182,8 @@ good-output (format (text;from-code x) "\n" (text;from-code y) "\n" (text;from-code z))] - (case (&;parse [(|> default-cursor - (update@ #;column (n.+ (n.dec offset-size)))) + (case (&;parse [(|> default-cursor (update@ #;column (n.+ (n.dec offset-size)))) + +0 (format "\"" good-input "\"")]) (#e;Error error) false @@ -193,7 +193,7 @@ parsed (code;text good-output))))) (test "Can handle comments." - (case (&;parse [default-cursor + (case (&;parse [default-cursor +0 (format comment (code;to-text sample))]) (#e;Error error) false @@ -201,7 +201,7 @@ (#e;Success [_ parsed]) (:: code;Eq<Code> = parsed sample))) (test "Will reject unbalanced multi-line comments." - (and (case (&;parse [default-cursor + (and (case (&;parse [default-cursor +0 (format "#(" "#(" unbalanced-comment ")#" (code;to-text sample))]) (#e;Error error) @@ -209,7 +209,7 @@ (#e;Success [_ parsed]) false) - (case (&;parse [default-cursor + (case (&;parse [default-cursor +0 (format "#(" unbalanced-comment ")#" ")#" (code;to-text sample))]) (#e;Error error) |