diff --git a/test/FlatBuffers/Integration/HaskellToScalaSpec.hs b/integration/FlatBuffers/Integration/HaskellToScalaSpec.hs similarity index 100% rename from test/FlatBuffers/Integration/HaskellToScalaSpec.hs rename to integration/FlatBuffers/Integration/HaskellToScalaSpec.hs diff --git a/test/FlatBuffers/Integration/RoundTripThroughFlatcSpec.hs b/integration/FlatBuffers/Integration/RoundTripThroughFlatcSpec.hs similarity index 100% rename from test/FlatBuffers/Integration/RoundTripThroughFlatcSpec.hs rename to integration/FlatBuffers/Integration/RoundTripThroughFlatcSpec.hs diff --git a/integration/Spec.hs b/integration/Spec.hs new file mode 100644 index 0000000..a824f8c --- /dev/null +++ b/integration/Spec.hs @@ -0,0 +1 @@ +{-# OPTIONS_GHC -F -pgmF hspec-discover #-} diff --git a/package.yaml b/package.yaml index 0c3bd4d..e6a4108 100644 --- a/package.yaml +++ b/package.yaml @@ -55,7 +55,30 @@ library: tests: test: main: Spec.hs - source-dirs: test/ + source-dirs: + - test/ + - test-common/ + dependencies: + - flatbuffers + - hspec + - hspec-core + - hspec-expectations-pretty-diff + - HUnit + - hspec-megaparsec + - hedgehog + - hw-hspec-hedgehog + - aeson + - aeson-pretty + - raw-strings-qq + - utf8-string + - process + - th-pprint + - pretty-simple + integration: + main: Spec.hs + source-dirs: + - integration/ + - test-common/ dependencies: - flatbuffers - hspec diff --git a/test/Examples.hs b/test-common/Examples.hs similarity index 100% rename from test/Examples.hs rename to test-common/Examples.hs diff --git a/test/Examples/Generated.hs b/test-common/Examples/Generated.hs similarity index 100% rename from test/Examples/Generated.hs rename to test-common/Examples/Generated.hs diff --git a/test/TestImports.hs b/test-common/TestImports.hs similarity index 100% rename from test/TestImports.hs rename to test-common/TestImports.hs diff --git a/test/FlatBuffers/Internal/Compiler/THSpec.hs b/test/FlatBuffers/Internal/Compiler/THSpec.hs index f554311..4eca145 100644 --- a/test/FlatBuffers/Internal/Compiler/THSpec.hs +++ b/test/FlatBuffers/Internal/Compiler/THSpec.hs @@ -78,6 +78,21 @@ spec = type_ = writeTable [] |] + describe "Haskell reserved keywords" $ do + it "type" $ + [r| table T { + type: bool; + }|] `shouldCompileTo` + [d| + data T + t :: Maybe Bool -> WriteTable T + t x = writeTable [ + optionalDef False writeBoolTableField x + ] + tType :: Table T -> Either ReadError Bool + tType = readTableFieldWithDef readBool 0 False + |] + describe "numeric fields + boolean" $ do it "normal fields" $ [r|