Commit Graph

25 Commits

Author SHA1 Message Date
mrkkrp
49e80775ef added test to catch bugs similar to #25 2015-08-26 16:15:30 +06:00
mrkkrp
2390f9f753 swap ‘count’ and ‘count'’ 2015-08-25 15:55:57 +06:00
mrkkrp
388d8b7a43 finished tests for ‘Text.Megaparsec.Combinator’
Added the following tests:

* ‘count’
* ‘count'’
* ‘endBy’
* ‘endBy1’
* ‘sepBy’
* ‘sepBy1’
2015-08-25 15:42:44 +06:00
mrkkrp
a891ff6522 improved tests for ‘(<|>)’
Fixed a detail in existing test ‘prop_alternative_1’ and added new test
‘prop_alternative_2’ to directly catch bugs like #23. Re-indexed some
tests.
2015-08-24 16:35:58 +06:00
mrkkrp
0e3040eaed some tests for ‘Text.Megaparsec.Combinator’
The following combinators are currently tested:

* ‘between’
* ‘choice’
* ‘manyTill’
* ‘someTill’
* ‘option’
* ‘skipMany’
* ‘skipSome’
2015-08-24 15:05:41 +06:00
mrkkrp
ff8905287b some tests for ‘Text.Megaparsec.Perm’
Although the collection of tests is fairly modest, ‘prop_perm_0’ is
quite dense and should be enough for a start.
2015-08-24 14:01:54 +06:00
mrkkrp
45f449ddb2 prefer longest match in ‘mergeError’, fixes #23
Since ‘mergeError’ is only used to merge errors from alternative
branches of parsing, longest match should be preferred.
2015-08-24 01:45:12 +06:00
mrkkrp
7dd2ad94ff minor corrections 2015-08-22 15:02:34 +06:00
mrkkrp
aa4189f4bc move test helpers to ‘Util’ module
So we can reuse them to test other modules.
2015-08-22 02:46:13 +06:00
mrkkrp
85be098854 more tests for ‘Text.Megaparsec.Prim’
Added test for the following primitive combinators:

* ‘lookAhead’
* ‘token’
* ‘tokens’
2015-08-22 01:13:20 +06:00
mrkkrp
24afab66c8 more tests for ‘Text.Megaparsec.Prim’
Combinator-specific tests added:

* ‘label’
* ‘hidden’
* ‘try’
* ‘lookAhead’
* ‘notFollowedBy’
2015-08-21 20:21:55 +06:00
mrkkrp
816da3d682 tests for ‘Text.Megaparsec.Prim’ written
More tests need to be written, especially for primitive
combinators. This commit also improves testing utilities and refactors
some stuff.
2015-08-20 17:12:44 +06:00
mrkkrp
455bfa3076 major improvements of ‘Text.Megaparsec.Prim’
* Removed ‘optionMaybe’ parser, because ‘optional’ from
  ‘Control.Applicative’ does the same thing.

* Renamed ‘tokenPrim’ → ‘token’, removed old ‘token’, because
  ‘tokenPrim’ is more general and ‘token’ is little used.

* Fixed bug with ‘notFollowedBy’ always succeeded with parsers that
  don't consume input, see #6.

* Hint system introduced that greatly improved quality of error messages
  and made code of ‘Text.Megaparsec.Prim’ a lot clearer.

The improvements affected other modules too:

* Some parsers from ‘Text.Megaparsec.Combinators’ now live in
  ‘Text.Megaparsec.Prim’.

* Hint system improved error messages, so I needed to rewrite test for
  ‘Text.Megaparsec.Char.eol’, since it's error messages are very
  intelligent now and cannot be emulated by ‘newline’ and ‘crlf’ parsers
  used separately.

* Test for Bug9 from old-tests is passed successfully again.
2015-08-17 21:58:59 +06:00
mrkkrp
287a777e6c cosmetic changes (indentation, etc) 2015-08-13 00:02:49 +06:00
mrkkrp
77a54394b5 extend collection of character parsers, close #16
Added new character parsers in ‘Text.Megaparsec.Char’:

* ‘controlChar’
* ‘printChar’
* ‘markChar’
* ‘numberChar’
* ‘punctuationChar’
* ‘symbolChar’
* ‘separatorChar’
* ‘asciiChar’
* ‘latin1Char’
* ‘charCategory’

Renamed some parsers:

‘spaces’   → ‘space’
‘space’    → ‘spaceChar’
‘lower’    → ‘lowerChar’
‘upper’    → ‘upperChar’
‘letter’   → ‘letterChar’
‘alphaNum’ → ‘alphaNumChar’
‘digit’    → ‘digitChar’
‘octDigit’ → ‘octDigitChar’
‘hexDigit’ → ‘hexDigitChar’

Descriptions of old parsers have been updated to accent some
Unicode-specific moments. For example, old description of ‘letter’
stated that it parses letters from “a” to “z” and from “A” to “Z”. This
is wrong, since it used ‘Data.Char.isAlpha’ predicate internally and
thus parsed many more characters.
2015-08-12 23:00:03 +06:00
mrkkrp
c13ca493ae experimental branch with different Messages 2015-08-11 18:15:02 +06:00
mrkkrp
da48d0c690 finished tests for ‘Text.Megaparsec.Char’ 2015-08-11 03:22:29 +06:00
mrkkrp
bb074cc52b fixed a regression in ‘Text.Megaparsec.Error’
I've improved tests so this sort of bug won't appear in future.
2015-08-11 03:19:16 +06:00
mrkkrp
e890c715e2 refactoring, more tests for ‘Text.Megaparsec.Char’ 2015-08-09 00:42:47 +06:00
mrkkrp
dedbe7a897 fix regression in ‘setErrorMessage’, add tests
New tests shows that I had wrong assumption about workings of this
particular function. This is not a problem, though, complete test-suite
will eliminate this sort of nuisance soon.
2015-08-09 00:38:30 +06:00
mrkkrp
ceb5d9bc16 some tests for ‘Text.Megaparsec.Char’ 2015-08-08 15:49:57 +06:00
mrkkrp
eb8fdcce2f tests for ‘Text.Megaparsec.Error’ 2015-08-03 23:44:11 +06:00
mrkkrp
866bcdec58 some tests written 2015-08-03 13:19:23 +06:00
mrkkrp
3ef5e5e621 renamed ‘MegaParsec’ → ‘Megaparsec’, close #10 2015-08-01 22:24:45 +06:00
mrkkrp
ec57da40b0 reorganized tests 2015-07-31 18:59:26 +06:00