[Git][ghc/ghc][wip/T23479] Added tests

Serge S. Gulin (@gulin.serge) gitlab at gitlab.haskell.org
Sun Aug 25 18:51:11 UTC 2024



Serge S. Gulin pushed to branch wip/T23479 at Glasgow Haskell Compiler / GHC


Commits:
e1ec0ec1 by Serge S. Gulin at 2024-08-25T21:50:56+03:00
Added tests

- - - - -


4 changed files:

- testsuite/tests/javascript/Makefile
- + testsuite/tests/javascript/T23479.hs
- + testsuite/tests/javascript/T23479.stdout
- testsuite/tests/javascript/all.T


Changes:

=====================================
testsuite/tests/javascript/Makefile
=====================================
@@ -7,3 +7,9 @@ T24495:
 	./T24495
 	# check that the optimization occurred
 	grep -c appendToHsStringA T24495.dump-js
+
+T23479:
+	'$(TEST_HC)' $(TEST_HC_OPTS) T23479.hs -v0 -O1 -dsuppress-uniques -ddump-js -ddump-to-file
+	./T23479
+	# check that the optimization occurred
+	grep -c 'h$decodeUtf8z' T23479.dump-js


=====================================
testsuite/tests/javascript/T23479.hs
=====================================
@@ -0,0 +1,15 @@
+{-# LANGUAGE MagicHash #-}
+
+import GHC.Prim
+
+import GHC.JS.Prim
+
+foreign import javascript "((x) => { console.log(x); })"
+  js_log1 :: JSVal -> IO ()
+
+main :: IO ()
+main = do
+  js_log1 (JSVal (unsafeUnpackJSStringUtf8## test_addr_1))
+  where
+    test_addr_1 :: Addr#
+    test_addr_1 = "test_val_1"#


=====================================
testsuite/tests/javascript/T23479.stdout
=====================================
@@ -0,0 +1,2 @@
+test_val_1
+1


=====================================
testsuite/tests/javascript/all.T
=====================================
@@ -22,3 +22,5 @@ test('T23346', normal, compile_and_run, [''])
 test('T22455', normal, compile_and_run, ['-ddisable-js-minifier'])
 test('T23565', normal, compile_and_run, [''])
 test('T24495', normal, makefile_test, ['T24495'])
+
+test('T23479', normal, makefile_test, ['T23479'])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e1ec0ec1fae5fbd64154addc68be8882033fa18e

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e1ec0ec1fae5fbd64154addc68be8882033fa18e
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240825/2af06ad3/attachment-0001.html>


More information about the ghc-commits mailing list