Menu

#7 Solution to regular expression is no longer valid

v1.0 (example)
open
nobody
None
3
2016-12-15
2016-12-15
No

On windows, on a 64 bits machine, the following HUnit test code

module Main where
import Test.HUnit
import Text.Regex.Posix

testRegexSimple :: Test
testRegexSimple = TestCase $ do
assertBool "pattern matches regex ^(a)|(p)$" ( "p" =~ "^(a)|(p)$" )

testRegex :: Test
testRegex = TestCase $ do
assertBool "pattern matches regex ^(ab+cd?)|(ef{2}g{3,6}h{3,})|(p)$" ( "p" =~ "^(ab+cd?)|(ef{2}g{3,6}h{3,})|(p)$" )

tests = TestList
TestLabel "Regex Simple" testRegexSimple,
TestLabel "Regex" testRegex

main :: IO Counts
main = do runTestTT tests

runs perfectly using Haskell platform 2013.2.0.0 with ghc 7.6.3.

However, on stack LTS 7.13 with ghc 8.0.1 the second test fails! I assume this behaviour is the result of a bug.

Both use regex-posix 0.95.2, so it might be an error in the compiler
see https://ghc.haskell.org/trac/ghc/ticket/12974,
or it is a bug that was "hidden" by the old compiler...

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.