summaryrefslogtreecommitdiff
path: root/testsuite/tests/parser
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/parser')
-rw-r--r--testsuite/tests/parser/should_run/NegativeZero.hs25
-rw-r--r--testsuite/tests/parser/should_run/NegativeZero.stdout8
-rw-r--r--testsuite/tests/parser/should_run/all.T1
3 files changed, 34 insertions, 0 deletions
diff --git a/testsuite/tests/parser/should_run/NegativeZero.hs b/testsuite/tests/parser/should_run/NegativeZero.hs
new file mode 100644
index 0000000000..36e483bd37
--- /dev/null
+++ b/testsuite/tests/parser/should_run/NegativeZero.hs
@@ -0,0 +1,25 @@
+-- | Test for @NegativeLiterals@ extension (see GHC #13211)
+
+{-# LANGUAGE NegativeLiterals #-}
+
+floatZero0 = 0 :: Float
+floatZero1 = 0.0 :: Float
+
+floatNegZero0 = -0 :: Float
+floatNegZero1 = -0.0 :: Float
+
+doubleZero0 = 0 :: Double
+doubleZero1 = 0.0 :: Double
+
+doubleNegZero0 = -0 :: Double
+doubleNegZero1 = -0.0 :: Double
+
+main = do
+ print (isNegativeZero floatZero0)
+ print (isNegativeZero floatZero1)
+ print (isNegativeZero floatNegZero0)
+ print (isNegativeZero floatNegZero1)
+ print (isNegativeZero doubleZero0)
+ print (isNegativeZero doubleZero1)
+ print (isNegativeZero doubleNegZero0)
+ print (isNegativeZero doubleNegZero1)
diff --git a/testsuite/tests/parser/should_run/NegativeZero.stdout b/testsuite/tests/parser/should_run/NegativeZero.stdout
new file mode 100644
index 0000000000..9dc212300a
--- /dev/null
+++ b/testsuite/tests/parser/should_run/NegativeZero.stdout
@@ -0,0 +1,8 @@
+False
+False
+True
+True
+False
+False
+True
+True
diff --git a/testsuite/tests/parser/should_run/all.T b/testsuite/tests/parser/should_run/all.T
index bb5e4fde39..31dea7f5b7 100644
--- a/testsuite/tests/parser/should_run/all.T
+++ b/testsuite/tests/parser/should_run/all.T
@@ -10,3 +10,4 @@ test('BinaryLiterals0', normal, compile_and_run, [''])
test('BinaryLiterals1', [], compile_and_run, [''])
test('BinaryLiterals2', [], compile_and_run, [''])
test('T10807', normal, compile_and_run, [''])
+test('NegativeZero', normal, compile_and_run, [''])