Skip to content

Commit 5e52fe2

Browse files
committed
[ new ] Dummy Test.WASM that only runs on wasm32-wasi-cabal test
1 parent cf683b6 commit 5e52fe2

File tree

4 files changed

+63
-2
lines changed

4 files changed

+63
-2
lines changed

agda-language-server.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ test-suite als-test
157157
other-modules:
158158
Test.LSP
159159
Test.SrcLoc
160+
Test.WASM
160161
Agda
161162
Agda.Convert
162163
Agda.IR

src/Options.hs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ versionString =
8282
"Agda v2.7.0.1 Language Server v" <> show versionNumber
8383
#elif MIN_VERSION_Agda(2,6,4)
8484
"Agda v2.6.4.3 Language Server v" <> show versionNumber
85-
#elif MIN_VERSION_Agda(2,6,3)
86-
"Agda v2.6.3 Language Server v" <> show versionNumber
8785
#else
8886
error "Unsupported Agda version"
8987
#endif

test/Test.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
{-# LANGUAGE CPP #-}
2+
13
import Data.Proxy (Proxy (..))
24
import Data.Typeable (Typeable)
35
import qualified Test.LSP as LSP
46
import qualified Test.SrcLoc as SrcLoc
7+
#if defined(wasm32_HOST_ARCH)
8+
import qualified Test.WASM as WASM
9+
#endif
510
import Test.Tasty
611
import Test.Tasty.Options
712

@@ -27,4 +32,7 @@ tests = askOption $ \(AlsPathOption alsPath) ->
2732
"Tests"
2833
[ SrcLoc.tests,
2934
LSP.tests alsPath
35+
#if defined(wasm32_HOST_ARCH)
36+
, WASM.tests alsPath
37+
#endif
3038
]

test/Test/WASM.hs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{-# LANGUAGE CPP #-}
2+
{-# LANGUAGE OverloadedStrings #-}
3+
4+
module Test.WASM (tests) where
5+
6+
import Test.Tasty
7+
import Test.Tasty.HUnit
8+
9+
#if defined(wasm32_HOST_ARCH)
10+
11+
tests :: FilePath -> TestTree
12+
tests alsPath = testGroup "WASM Tests"
13+
[ testCase "WASM generation" wasmGenerationTest
14+
, testCase "WASM compilation" wasmCompilationTest
15+
, testCase "WASM execution dummy" wasmExecutionTest
16+
]
17+
18+
wasmGenerationTest :: IO ()
19+
wasmGenerationTest = do
20+
putStrLn "Testing WASM generation..."
21+
-- Dummy test for WASM generation
22+
-- In a real implementation, this would:
23+
-- 1. Compile Agda code to WASM
24+
-- 2. Verify the WASM file is generated
25+
-- 3. Check WASM file structure/validity
26+
assertBool "WASM generation succeeds" True
27+
28+
wasmCompilationTest :: IO ()
29+
wasmCompilationTest = do
30+
putStrLn "Testing WASM compilation..."
31+
-- Dummy test for WASM compilation
32+
-- In a real implementation, this would:
33+
-- 1. Take sample Agda code
34+
-- 2. Compile it with WASM backend
35+
-- 3. Verify compilation succeeds
36+
assertBool "WASM compilation succeeds" True
37+
38+
wasmExecutionTest :: IO ()
39+
wasmExecutionTest = do
40+
putStrLn "Testing WASM execution..."
41+
-- Dummy test for WASM execution
42+
-- In a real implementation, this would:
43+
-- 1. Load compiled WASM module
44+
-- 2. Execute WASM functions
45+
-- 3. Verify expected results
46+
assertBool "WASM execution works" True
47+
48+
#else
49+
50+
-- When not building for WASM, provide empty tests
51+
tests :: FilePath -> TestTree
52+
tests _ = testGroup "WASM Tests (disabled - only available when building for wasm32 architecture)" []
53+
54+
#endif

0 commit comments

Comments
 (0)