-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disallow tab characters as spaces (#1523)
- Loading branch information
1 parent
f5402aa
commit ccce5a4
Showing
6 changed files
with
71 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Parsing | ||
( allTests, | ||
) | ||
where | ||
|
||
import Base | ||
import Parsing.Negative qualified as N | ||
|
||
allTests :: TestTree | ||
allTests = testGroup "Parsing tests" [N.allTests] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module Parsing.Negative where | ||
|
||
import Base | ||
import Juvix.Compiler.Pipeline | ||
import Juvix.Parser.Error | ||
|
||
root :: FilePath | ||
root = "tests/negative" | ||
|
||
data NegTest = NegTest | ||
{ _name :: String, | ||
_relDir :: FilePath, | ||
_file :: FilePath | ||
} | ||
|
||
testDescr :: NegTest -> TestDescr | ||
testDescr NegTest {..} = | ||
let tRoot = root </> _relDir | ||
in TestDescr | ||
{ _testName = _name, | ||
_testRoot = tRoot, | ||
_testAssertion = Single $ do | ||
let entryPoint = defaultEntryPoint _file | ||
res <- runIOEither (upToParsing entryPoint) | ||
case mapLeft fromJuvixError res of | ||
Left (Just (_ :: ParserError)) -> return () | ||
Left Nothing -> assertFailure "The parser did not find an error." | ||
Right _ -> assertFailure "An error ocurred but it was not in the parser." | ||
} | ||
|
||
allTests :: TestTree | ||
allTests = | ||
testGroup | ||
"Parsing negative tests" | ||
( map (mkTest . testDescr) scoperErrorTests | ||
) | ||
|
||
scoperErrorTests :: [NegTest] | ||
scoperErrorTests = | ||
[ NegTest | ||
"Tab character" | ||
"." | ||
"Tab.juvix" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module Tab; | ||
|
||
end; |