summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorJosh Meredith <joshmeredith2008@gmail.com>2023-03-10 16:16:00 +0000
committerJosh Meredith <joshmeredith2008@gmail.com>2023-03-13 03:56:03 +0000
commit047e9d4f10e4124899887449dc52b9e72a7d3ea6 (patch)
tree8f30d6843f3c31fb32ac39c12abbee81921fb8ec /testsuite
parentec263a59b886ea616dabce349df7a377d5356dd5 (diff)
downloadhaskell-047e9d4f10e4124899887449dc52b9e72a7d3ea6.tar.gz
JS: fix implementation of forceBool to use JS backend syntaxwip/js-forceBool
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/javascript/T23101.hs22
-rw-r--r--testsuite/tests/javascript/T23101.stdout10
-rw-r--r--testsuite/tests/javascript/all.T4
3 files changed, 36 insertions, 0 deletions
diff --git a/testsuite/tests/javascript/T23101.hs b/testsuite/tests/javascript/T23101.hs
new file mode 100644
index 0000000000..4aad09d64e
--- /dev/null
+++ b/testsuite/tests/javascript/T23101.hs
@@ -0,0 +1,22 @@
+
+foreign import javascript "(($1) => { return $1; })"
+ bool_id :: Bool -> Bool
+
+foreign import javascript "(($1) => { return !$1; })"
+ bool_not :: Bool -> Bool
+
+foreign import javascript "(($1) => { console.log($1); })"
+ bool_log :: Bool -> IO ()
+
+main :: IO ()
+main = do
+ bool_log True
+ bool_log False
+ bool_log (bool_id True)
+ bool_log (bool_id False)
+ bool_log (bool_not True)
+ bool_log (bool_not False)
+ print (bool_id True)
+ print (bool_id False)
+ print (bool_not True)
+ print (bool_not False)
diff --git a/testsuite/tests/javascript/T23101.stdout b/testsuite/tests/javascript/T23101.stdout
new file mode 100644
index 0000000000..b826e457fe
--- /dev/null
+++ b/testsuite/tests/javascript/T23101.stdout
@@ -0,0 +1,10 @@
+true
+false
+true
+false
+false
+true
+True
+False
+False
+True
diff --git a/testsuite/tests/javascript/all.T b/testsuite/tests/javascript/all.T
new file mode 100644
index 0000000000..6ff2a7818a
--- /dev/null
+++ b/testsuite/tests/javascript/all.T
@@ -0,0 +1,4 @@
+# These are JavaScript-specific tests
+setTestOpts(when(not(js_arch()),skip))
+
+test('T23101', normal, compile_and_run, [''])