forked from haskell/text
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix haskell#277: Reword toCaseFold database generation
- Add property and regression test that toCaseFold should be idempotent - Add scripts/tests.sh to run tests with all GHCs. There are plenty of setup commands to pass. - Rework CaseFolding.hs so it considers that toLower behaves differently with different GHCs, and therefore fallbacks to it only when it behaves consistently. For that purpose a helper `scripts/Dump.hs` is added. Note: `toLower`, `toUpper`, and `toTitle` would benefit from using dumped database as well. This commit is already quite big, so that is left for a follow up.
- Loading branch information
Showing
11 changed files
with
738 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- this project doesn't have local 'text' package, | ||
-- so tests build faster. | ||
|
||
packages: tests | ||
tests: True |
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,15 @@ | ||
-- This script is used to dump casing DB from GHCs base library | ||
|
||
import Data.Char | ||
|
||
main :: IO () | ||
main = print | ||
[ (c, u, l, t) | ||
| c <- [ minBound .. maxBound ] | ||
, let u = toUpper c | ||
, let l = toLower c | ||
, let t = toTitle c | ||
|
||
-- we dump only characters which have some transformations | ||
, c /= u || c /= l || c /= t | ||
] |
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,23 @@ | ||
#!/bin/sh | ||
|
||
set -ex | ||
|
||
dump() { | ||
"runghc-$1" Dump.hs > "db-$1.txt" | ||
} | ||
|
||
dump 7.0.4 | ||
dump 7.2.2 | ||
dump 7.4.2 | ||
dump 7.6.3 | ||
dump 7.8.4 | ||
dump 7.10.3 | ||
|
||
dump 8.0.2 | ||
dump 8.2.2 | ||
dump 8.4.4 | ||
dump 8.6.5 | ||
dump 8.8.4 | ||
dump 8.10.2 | ||
|
||
# dump 9.0.1 |
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,30 @@ | ||
#!/bin/sh | ||
|
||
set -ex | ||
|
||
runtest() { | ||
HC=$1 | ||
shift | ||
|
||
# EDIT last line to pass arguments | ||
|
||
cabal run text-tests:test:tests \ | ||
--project-file=cabal.tests.project \ | ||
--builddir="dist-newstyle/$HC" \ | ||
--with-compiler="$HC" \ | ||
-- "$@" | ||
} | ||
|
||
runtest ghc-8.10.2 "$@" | ||
runtest ghc-8.8.4 "$@" | ||
runtest ghc-8.6.5 "$@" | ||
runtest ghc-8.4.4 "$@" | ||
runtest ghc-8.2.2 "$@" | ||
runtest ghc-8.0.2 "$@" | ||
|
||
runtest ghc-7.10.3 "$@" | ||
runtest ghc-7.8.4 "$@" | ||
runtest ghc-7.6.3 "$@" | ||
runtest ghc-7.4.2 "$@" | ||
runtest ghc-7.2.2 "$@" | ||
runtest ghc-7.0.4 "$@" |
Oops, something went wrong.