Skip to content

Run slowest tests last and print status updates #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ Bugfixes:

Other improvements:

- Run slowest tests last and print status updates (#72)

## [v6.0.1](https://github.com/purescript-contrib/purescript-string-parsers/releases/tag/v6.0.1) - 2021-05-11

Other improvements:
- Fix transitive dependencies errors found by Spago 0.20 (#71 by @milesfrain)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think it's necessary to name authors in the changelog.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I didn't actually read the contrib template carefully enough in this case. Seems like there's a mismatch between core (no username) and contrib (with username).

I think no-username is easier.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't used to associate any usernames with pull requests, but we'd like to going forward (for core, contrib, etc.). However, it is optional if you'd rather not have your username added.

- Fix transitive dependencies errors found by Spago 0.20 (#71)

## [v6.0.0](https://github.com/purescript-contrib/purescript-string-parsers/releases/tag/v6.0.0) - 2021-02-26

Expand Down
23 changes: 15 additions & 8 deletions test/CodePoints.purs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import Data.String.CodeUnits (singleton)
import Data.String.Common as SC
import Data.Unfoldable (replicate)
import Effect (Effect)
import Effect.Class.Console (log)
import Test.Assert (assert', assert)
import Text.Parsing.StringParser (Parser, runParser, try)
import Text.Parsing.StringParser.CodePoints (anyDigit, char, eof, string, anyChar, regex)
import Text.Parsing.StringParser.Combinators (many1, endBy1, sepBy1, optionMaybe, many, manyTill, many1Till, chainl, fix, between)
import Text.Parsing.StringParser.Expr (Assoc(..), Operator(..), buildExprParser)
import Text.Parsing.StringParser.CodePoints (anyDigit, char, eof, string, anyChar, regex)

parens :: forall a. Parser a -> Parser a
parens = between (string "(") (string ")")
Expand Down Expand Up @@ -66,11 +67,8 @@ expectResult res p input = runParser p input == Right res

testCodePoints :: Effect Unit
testCodePoints = do
assert' "many should not blow the stack" $ canParse (many (string "a")) (SC.joinWith "" $ replicate 100000 "a")
assert' "many failing after" $ parseFail (do
as <- many (string "a")
eof
pure as) (SC.joinWith "" (replicate 100000 "a") <> "b" )

log "Running basic tests"

assert $ expectResult 3 nested "(((a)))"
assert $ expectResult ("a":"a":"a":Nil) (many (string "a")) "aaa"
Expand All @@ -93,10 +91,19 @@ testCodePoints = do
assert $ expectResult Nil (manyTill (string "a") (string "b")) "b"
assert $ expectResult (NonEmptyList ("a" :| "a":"a":Nil)) (many1Till (string "a") (string "b")) "aaab"
assert $ parseFail (many1Till (string "a") (string "b")) "b"
-- check against overflow
assert $ canParse (many1Till (string "a") (string "and")) $ (fold <<< take 10000 $ repeat "a") <> "and"
-- check correct order
assert $ expectResult (NonEmptyList ('a' :| 'b':'c':Nil)) (many1Till anyChar (string "d")) "abcd"
assert $ expectResult "\x458CA" (string "\x458CA" <* char ']' <* eof ) "\x458CA]"
assert $ expectResult "\x458CA" (string "\x458CA" <* string ")" <* eof ) "\x458CA)"
assert $ expectResult '\xEEE2' (char '\xEEE2' <* eof ) "\xEEE2"

log "Running overflow tests (may take a while)"

-- check against overflow
assert $ canParse (many1Till (string "a") (string "and")) $ (fold <<< take 10000 $ repeat "a") <> "and"

assert' "many should not blow the stack" $ canParse (many (string "a")) (SC.joinWith "" $ replicate 100000 "a")
assert' "many failing after" $ parseFail (do
as <- many (string "a")
eof
pure as) (SC.joinWith "" (replicate 100000 "a") <> "b" )
23 changes: 15 additions & 8 deletions test/CodeUnits.purs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import Data.String.CodeUnits (singleton)
import Data.String.Common as SC
import Data.Unfoldable (replicate)
import Effect (Effect)
import Effect.Class.Console (log)
import Test.Assert (assert', assert)
import Text.Parsing.StringParser (Parser, runParser, try)
import Text.Parsing.StringParser.CodeUnits (anyDigit, eof, string, anyChar, regex)
import Text.Parsing.StringParser.Combinators (many1, endBy1, sepBy1, optionMaybe, many, manyTill, many1Till, chainl, fix, between)
import Text.Parsing.StringParser.Expr (Assoc(..), Operator(..), buildExprParser)
import Text.Parsing.StringParser.CodeUnits (anyDigit, eof, string, anyChar, regex)

parens :: forall a. Parser a -> Parser a
parens = between (string "(") (string ")")
Expand Down Expand Up @@ -66,11 +67,8 @@ expectResult res p input = runParser p input == Right res

testCodeUnits :: Effect Unit
testCodeUnits = do
assert' "many should not blow the stack" $ canParse (many (string "a")) (SC.joinWith "" $ replicate 100000 "a")
assert' "many failing after" $ parseFail (do
as <- many (string "a")
eof
pure as) (SC.joinWith "" (replicate 100000 "a") <> "b" )

log "Running basic tests"

assert $ expectResult 3 nested "(((a)))"
assert $ expectResult ("a":"a":"a":Nil) (many (string "a")) "aaa"
Expand All @@ -93,7 +91,16 @@ testCodeUnits = do
assert $ expectResult Nil (manyTill (string "a") (string "b")) "b"
assert $ expectResult (NonEmptyList ("a" :| "a":"a":Nil)) (many1Till (string "a") (string "b")) "aaab"
assert $ parseFail (many1Till (string "a") (string "b")) "b"
-- check against overflow
assert $ canParse (many1Till (string "a") (string "and")) $ (fold <<< take 10000 $ repeat "a") <> "and"
-- check correct order
assert $ expectResult (NonEmptyList ('a' :| 'b':'c':Nil)) (many1Till anyChar (string "d")) "abcd"

log "Running overflow tests (may take a while)"

-- check against overflow
assert $ canParse (many1Till (string "a") (string "and")) $ (fold <<< take 10000 $ repeat "a") <> "and"

assert' "many should not blow the stack" $ canParse (many (string "a")) (SC.joinWith "" $ replicate 100000 "a")
assert' "many failing after" $ parseFail (do
as <- many (string "a")
eof
pure as) (SC.joinWith "" (replicate 100000 "a") <> "b" )