Skip to content

Commit 79ae94b

Browse files
author
Patrick Thomson
committed
Go tests work. Now to generalize this
1 parent 1232bc5 commit 79ae94b

File tree

3 files changed

+39
-7
lines changed

3 files changed

+39
-7
lines changed

semantic-go/BUILD.bazel

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,33 @@ load(
44
"//:build/common.bzl",
55
"semantic_language_library",
66
)
7+
load(
8+
"@rules_haskell//haskell:defs.bzl",
9+
"haskell_test",
10+
)
711

812
semantic_language_library(
913
name = "semantic-go",
1014
srcs = glob(["src/**/*.hs"]),
1115
language = "go",
1216
)
17+
18+
haskell_test(
19+
name = "test",
20+
srcs = ["test/PreciseTest.hs"],
21+
data = ["@tree-sitter-go//:corpus"],
22+
deps = [
23+
":semantic-go",
24+
"//:base",
25+
"//:bytestring",
26+
"//:text",
27+
"//semantic:fixtureshim",
28+
"//semantic-ast",
29+
"@stackage//:bazel-runfiles",
30+
"@stackage//:hedgehog",
31+
"@stackage//:pathtype",
32+
"@stackage//:tasty",
33+
"@stackage//:tasty-hedgehog",
34+
"@stackage//:tasty-hunit",
35+
],
36+
)

semantic-go/test/PreciseTest.hs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{-# LANGUAGE DisambiguateRecordFields, OverloadedStrings, TypeApplications #-}
1+
{-# LANGUAGE DisambiguateRecordFields, OverloadedStrings, TypeApplications, ImplicitParams #-}
22
module Main (main) where
33

44

@@ -8,14 +8,20 @@ import AST.TestHelpers
88
import AST.Unmarshal
99
import qualified System.Path as Path
1010
import Test.Tasty
11-
11+
import qualified Bazel.Runfiles as Runfiles
12+
import qualified System.Path.Fixture as Fixture
1213

1314
main :: IO ()
14-
main
15-
= Path.absDir <$> Go.getTestCorpusDir
16-
>>= readCorpusFiles'
17-
>>= traverse (testCorpus parse)
18-
>>= defaultMain . tests
15+
main = do
16+
rf <- Runfiles.create
17+
-- dirs <- Path.absDir <$> Go.getTestCorpusDir
18+
let ?project = Path.relDir "semantic-go"
19+
?runfiles = rf
20+
let dirs = Fixture.bazelDir "/../external/tree-sitter-go/corpus"
21+
22+
readCorpusFiles' dirs
23+
>>= traverse (testCorpus parse)
24+
>>= defaultMain . tests
1925
where parse = parseByteString @Go.SourceFile @() tree_sitter_go
2026

2127
tests :: [TestTree] -> TestTree

semantic-ruby/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ semantic_language_library(
1111
language = "ruby",
1212
nodetypes = "@tree-sitter-ruby//:src/node-types.json",
1313
)
14+
15+
haskell_test

0 commit comments

Comments
 (0)