diff options
author | Alec Theriault <alec.theriault@gmail.com> | 2019-01-08 10:28:10 -0800 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-01-16 14:17:11 -0500 |
commit | 582a96f422a8437f87da2539afc7d7e6772054df (patch) | |
tree | 97cde22e39fe965f2c3a8e6ab5d910b54933a657 /testsuite/tests/ghci.debugger | |
parent | 9fb2702dec3e9419e1a229f8cd678324e89fdddf (diff) | |
download | haskell-582a96f422a8437f87da2539afc7d7e6772054df.tar.gz |
Support printing `integer-simple` Integers in GHCi
This means that `:p` no longer leaks the implementation details of
`Integer` with `integer-simple`. The `print037` test case should
exercise all possible code paths for GHCi's code around printing
`Integer`s (both in `integer-simple` and `integer-gmp`).
`ghc` the package now also has a Cabal `integer-simple` flag (like the
`integer-gmp` one).
Diffstat (limited to 'testsuite/tests/ghci.debugger')
-rw-r--r-- | testsuite/tests/ghci.debugger/scripts/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/ghci.debugger/scripts/print037.script | 25 | ||||
-rw-r--r-- | testsuite/tests/ghci.debugger/scripts/print037.stdout | 5 |
3 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/tests/ghci.debugger/scripts/all.T b/testsuite/tests/ghci.debugger/scripts/all.T index 1ecf08f244..985f065d1f 100644 --- a/testsuite/tests/ghci.debugger/scripts/all.T +++ b/testsuite/tests/ghci.debugger/scripts/all.T @@ -45,6 +45,7 @@ test('print033', normal, ghci_script, ['print033.script']) test('print034', extra_files(['../GADT.hs', '../Test.hs']), ghci_script, ['print034.script']) test('print035', extra_files(['../Unboxed.hs']), ghci_script, ['print035.script']) test('print036', expect_broken(9046), ghci_script, ['print036.script']) +test('print037', normal, ghci_script, ['print037.script']) test('break001', [broken_without_gmp, extra_files(['../Test2.hs'])], ghci_script, ['break001.script']) test('break002', extra_files(['../Test2.hs']), ghci_script, ['break002.script']) diff --git a/testsuite/tests/ghci.debugger/scripts/print037.script b/testsuite/tests/ghci.debugger/scripts/print037.script new file mode 100644 index 0000000000..7bf332c175 --- /dev/null +++ b/testsuite/tests/ghci.debugger/scripts/print037.script @@ -0,0 +1,25 @@ +-- Test out printing of integers in GHCi + +-- With @integer-gmp@, small integer literals get converted directly into +-- @S# i#@. This optimization means that small integers are always already +-- evaluated in the output for @:p@. +-- +-- Since we want this test to work on @integer-simple@ too, we explicitly +-- force the literals. + +let smallNeg = -53 :: Integer +:f smallNeg + +let smallPos = 89 :: Integer +:f smallPos + +let zero = 0 :: Integer +:f zero + +let largeNeg = -4123841823694876543987265438957349857349 :: Integer +:f largeNeg + +let largePos = 5402398759384752938475029384750298347554 :: Integer +:f largePos + +:q diff --git a/testsuite/tests/ghci.debugger/scripts/print037.stdout b/testsuite/tests/ghci.debugger/scripts/print037.stdout new file mode 100644 index 0000000000..bce450ea3f --- /dev/null +++ b/testsuite/tests/ghci.debugger/scripts/print037.stdout @@ -0,0 +1,5 @@ +smallNeg = -53 +smallPos = 89 +zero = 0 +largeNeg = -4123841823694876543987265438957349857349 +largePos = 5402398759384752938475029384750298347554 |