Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename repo to hs-tokstyle and add a test.
- Loading branch information
Showing
6 changed files
with
58 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Tokstyle.CimpleSpec where | ||
|
||
import Test.Hspec | ||
|
||
import Tokstyle.Cimple.Lexer (runAlex) | ||
import Tokstyle.Cimple.Parser (parseCimple) | ||
|
||
|
||
spec :: Spec | ||
spec = | ||
describe "C parsing" $ do | ||
it "should parse a simple function" $ do | ||
let ast = runAlex "int a(void) { return 3; }" parseCimple | ||
ast `shouldBe` Right [()] | ||
|
||
it "should parse a type declaration" $ do | ||
let ast = runAlex "typedef struct Foo { int x; } Foo;" parseCimple | ||
ast `shouldBe` Right [()] |
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 @@ | ||
{-# OPTIONS_GHC -F -pgmF hspec-discover #-} |
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