From b8681fd206d5b5076b9737ee54f0cb0405a898d6 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 14 Mar 2022 01:09:08 -0400 Subject: Can now add type-vars to imported procedures from scripting languages. --- stdlib/source/test/lux/ffi.js.lux | 50 ++++++++++++++++---------------- stdlib/source/test/lux/ffi.lua.lux | 4 +-- stdlib/source/test/lux/ffi.py.lux | 10 +++---- stdlib/source/test/lux/ffi.rb.lux | 4 +-- stdlib/source/test/lux/target/js.lux | 2 +- stdlib/source/test/lux/target/python.lux | 6 ++-- 6 files changed, 38 insertions(+), 38 deletions(-) (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/lux/ffi.js.lux b/stdlib/source/test/lux/ffi.js.lux index 2b3cb7f96..b697c4b66 100644 --- a/stdlib/source/test/lux/ffi.js.lux +++ b/stdlib/source/test/lux/ffi.js.lux @@ -20,30 +20,30 @@ ["[1][0]" export]]) (/.import: Uint8Array - ["[1]::[0]"]) + "[1]::[0]") ... On Nashorn (/.import: java/lang/String - ["[1]::[0]" - (new [Uint8Array /.String]) - (getBytes [/.String] Uint8Array)]) + "[1]::[0]" + (new [Uint8Array /.String]) + (getBytes [/.String] Uint8Array)) ... On Node (/.import: Buffer - ["[1]::[0]" - ("static" from [/.String /.String] Buffer) - (toString [/.String] /.String)]) + "[1]::[0]" + ("static" from [/.String /.String] Buffer) + (toString [/.String] /.String)) ... On the browser (/.import: TextEncoder - ["[1]::[0]" - (new [/.String]) - (encode [/.String] Uint8Array)]) + "[1]::[0]" + (new [/.String]) + (encode [/.String] Uint8Array)) (/.import: TextDecoder - ["[1]::[0]" - (new [/.String]) - (decode [Uint8Array] /.String)]) + "[1]::[0]" + (new [/.String]) + (decode [Uint8Array] /.String)) (def: .public test Test @@ -96,12 +96,12 @@ (not (/.null? 0)) (not (/.null? "0")) (not (/.null? (|>>))))) - (_.cover [/.constant] - (|> (/.constant /.Function [parseFloat]) + (_.cover [/.global] + (|> (/.global /.Function [parseFloat]) "js object null?" not)) - (_.cover [/.closure] - (|> (/.closure [input/0] input/0) + (_.cover [/.function] + (|> (/.function [input/0] input/0) "js object null?" not)) (_.cover [/.on_browser? /.on_node_js? /.on_nashorn?] @@ -127,19 +127,19 @@ (let [encoding "utf8"] (text#= string (cond /.on_nashorn? - (let [binary (java/lang/String::getBytes [encoding] (:as java/lang/String string))] - (|> (java/lang/String::new [binary encoding]) + (let [binary (java/lang/String::getBytes encoding (:as java/lang/String string))] + (|> (java/lang/String::new binary encoding) (:as Text))) /.on_node_js? - (|> (Buffer::from [string encoding]) - (Buffer::toString [encoding])) + (|> (Buffer::from string encoding) + (Buffer::toString encoding)) ... On the browser - (let [binary (|> (TextEncoder::new [encoding]) - (TextEncoder::encode [string]))] - (|> (TextDecoder::new [encoding]) - (TextDecoder::decode [binary]))) + (let [binary (|> (TextEncoder::new encoding) + (TextEncoder::encode string))] + (|> (TextDecoder::new encoding) + (TextDecoder::decode binary))) )))) $/export.test diff --git a/stdlib/source/test/lux/ffi.lua.lux b/stdlib/source/test/lux/ffi.lua.lux index 682e34763..8639e374d 100644 --- a/stdlib/source/test/lux/ffi.lua.lux +++ b/stdlib/source/test/lux/ffi.lua.lux @@ -48,9 +48,9 @@ [/.Nil] [/.Table] )))) - (_.cover [/.Function /.closure] + (_.cover [/.Function /.function] (exec - (|> (/.closure [input/0] input/0) + (|> (/.function [input/0] input/0) (: /.Function) (: (Ex (_ a) (/.Object a)))) true)) diff --git a/stdlib/source/test/lux/ffi.py.lux b/stdlib/source/test/lux/ffi.py.lux index efa966c7d..911ea1c82 100644 --- a/stdlib/source/test/lux/ffi.py.lux +++ b/stdlib/source/test/lux/ffi.py.lux @@ -14,9 +14,9 @@ ["[1][0]" export]]) (/.import: os - ["[1]::[0]" - ("static" R_OK /.Integer) - ("static" W_OK /.Integer)]) + "[1]::[0]" + ("static" R_OK /.Integer) + ("static" W_OK /.Integer)) (def: .public test Test @@ -51,9 +51,9 @@ [/.None] [/.Dict] )))) - (_.cover [/.Function /.lambda] + (_.cover [/.Function /.function] (exec - (|> (/.lambda [input/0] input/0) + (|> (/.function [input/0] input/0) (: /.Function) (: (Ex (_ a) (/.Object a)))) true)) diff --git a/stdlib/source/test/lux/ffi.rb.lux b/stdlib/source/test/lux/ffi.rb.lux index b7e488547..75a89c833 100644 --- a/stdlib/source/test/lux/ffi.rb.lux +++ b/stdlib/source/test/lux/ffi.rb.lux @@ -12,8 +12,8 @@ ["[1][0]" export]]) (/.import: File - ["[1]::[0]" - ("static" SEPARATOR /.String)]) + "[1]::[0]" + ("static" SEPARATOR /.String)) (def: .public test Test diff --git a/stdlib/source/test/lux/target/js.lux b/stdlib/source/test/lux/target/js.lux index ae190fade..16366a141 100644 --- a/stdlib/source/test/lux/target/js.lux +++ b/stdlib/source/test/lux/target/js.lux @@ -34,7 +34,7 @@ ... Note: I have to call "eval" this way ... in order to avoid a quirk of calling eval in Node ... when the code is running under "use strict";. - (try (let [return ("js apply" (function.identity ("js constant" "eval")) (/.code code))] + (try (let [return ("js apply" (function.identity ("js constant" "eval")) [(/.code code)])] (if ("js object null?" return) {.#None} {.#Some return})))) diff --git a/stdlib/source/test/lux/target/python.lux b/stdlib/source/test/lux/target/python.lux index cb9a3551c..afcc8a43e 100644 --- a/stdlib/source/test/lux/target/python.lux +++ b/stdlib/source/test/lux/target/python.lux @@ -429,8 +429,8 @@ )))) (ffi.import: Dict - ["[1]::[0]" - (get [ffi.String] Any)]) + "[1]::[0]" + (get [ffi.String] Any)) (ffi.import: (dict [] ..Dict)) @@ -441,7 +441,7 @@ environment (..dict [])] (exec ("python exec" (/.code (it (/.var $output))) (:expected environment)) - (Dict::get [$output] environment)))) + (Dict::get $output environment)))) (def: test|access Test -- cgit v1.2.3