summaryrefslogtreecommitdiff
path: root/libraries/base/tests
diff options
context:
space:
mode:
authorHécate <hecate+gitlab@glitchbra.in>2020-06-30 23:09:23 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-07-18 07:26:42 -0400
commit6ba6a881c58459008f02fb4816f8dec2800c2b73 (patch)
treef160876889f9cc322494ba540837953179825edd /libraries/base/tests
parent750a1595ef31cdc335f3bab045b2f19a9c43ff93 (diff)
downloadhaskell-6ba6a881c58459008f02fb4816f8dec2800c2b73.tar.gz
Implement `fullCompilerVersion`
Follow-up of https://gitlab.haskell.org/ghc/ghc/-/issues/18403 This MR adds `fullCompilerVersion`, a function that shares the same backend as the `--numeric-version` GHC flag, exposing a full, three-digit version datatype.
Diffstat (limited to 'libraries/base/tests')
-rw-r--r--libraries/base/tests/SystemInfoTest.hs13
-rw-r--r--libraries/base/tests/SystemInfoTest.stdout1
-rw-r--r--libraries/base/tests/all.T1
3 files changed, 15 insertions, 0 deletions
diff --git a/libraries/base/tests/SystemInfoTest.hs b/libraries/base/tests/SystemInfoTest.hs
new file mode 100644
index 0000000000..ef8c829df4
--- /dev/null
+++ b/libraries/base/tests/SystemInfoTest.hs
@@ -0,0 +1,13 @@
+{-# LANGUAGE CPP #-}
+module Main where
+
+import Data.Version (showVersion)
+import System.Info (fullCompilerVersion)
+
+main :: IO ()
+main = if textualVersion == macroVersion
+ then putStrLn "Match"
+ else putStrLn $ "[!]" <> textualVersion <> "should be equal to " <> macroVersion
+ where
+ macroVersion = __GLASGOW_HASKELL_FULL_VERSION__
+ textualVersion = showVersion fullCompilerVersion
diff --git a/libraries/base/tests/SystemInfoTest.stdout b/libraries/base/tests/SystemInfoTest.stdout
new file mode 100644
index 0000000000..1796dc2720
--- /dev/null
+++ b/libraries/base/tests/SystemInfoTest.stdout
@@ -0,0 +1 @@
+Match
diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T
index 4a29e8b571..c29b5b3a63 100644
--- a/libraries/base/tests/all.T
+++ b/libraries/base/tests/all.T
@@ -12,6 +12,7 @@ def normalise_quotes (str):
#--------------------------------------
# Test functions
#--------------------------------------
+test('SystemInfoTest', normal, compile_and_run, [''])
test('readFloat', exit_code(1), compile_and_run, [''])
test('enumDouble', normal, compile_and_run, [''])
test('enumRatio', normal, compile_and_run, [''])