summaryrefslogtreecommitdiff
path: root/testsuite/tests/warnings
diff options
context:
space:
mode:
authorPhil Ruffwind <rf@rufflewind.com>2017-05-11 15:41:08 -0400
committerBen Gamari <ben@smart-cactus.org>2017-05-12 18:26:51 -0400
commitc068c38727b7bd7a1a75495167f7470abb7bf866 (patch)
tree24dba7d8982d0538272fa3caacbc521bb2f295d6 /testsuite/tests/warnings
parent1edee7a8b5ca24156cb6e21bde6d611a0ba63882 (diff)
downloadhaskell-c068c38727b7bd7a1a75495167f7470abb7bf866.tar.gz
Render \t as 8 spaces in caret diagnostics
Test Plan: validate Reviewers: austin, bgamari, rwbarton Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #13664 Differential Revision: https://phabricator.haskell.org/D3549
Diffstat (limited to 'testsuite/tests/warnings')
-rw-r--r--testsuite/tests/warnings/should_fail/CaretDiagnostics1.hs3
-rw-r--r--testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr8
-rw-r--r--testsuite/tests/warnings/should_fail/all.T15
3 files changed, 25 insertions, 1 deletions
diff --git a/testsuite/tests/warnings/should_fail/CaretDiagnostics1.hs b/testsuite/tests/warnings/should_fail/CaretDiagnostics1.hs
index 6ecadf690c..3ebb5ee965 100644
--- a/testsuite/tests/warnings/should_fail/CaretDiagnostics1.hs
+++ b/testsuite/tests/warnings/should_fail/CaretDiagnostics1.hs
@@ -15,3 +15,6 @@ main = do
fóo :: Int
fóo = ()
+
+tabby :: Int
+tabby = ()
diff --git a/testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr b/testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr
index 68fbfa7714..600b7c78d3 100644
--- a/testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr
+++ b/testsuite/tests/warnings/should_fail/CaretDiagnostics1.stderr
@@ -70,3 +70,11 @@ CaretDiagnostics1.hs:17:7-8: error:
|
17 | fóo = ()
| ^^
+
+CaretDiagnostics1.hs:20:17-18: error:
+ • Couldn't match expected type ‘Int’ with actual type ‘()’
+ • In the expression: ()
+ In an equation for ‘tabby’: tabby = ()
+ |
+20 | tabby = ()
+ | ^^
diff --git a/testsuite/tests/warnings/should_fail/all.T b/testsuite/tests/warnings/should_fail/all.T
index 71a7a97157..73117a957c 100644
--- a/testsuite/tests/warnings/should_fail/all.T
+++ b/testsuite/tests/warnings/should_fail/all.T
@@ -1,3 +1,16 @@
+import re
+
+def normalise_whitespace_carefully(s):
+ # Merge contiguous whitespace characters into a single space
+ # except on caret diagnostic lines
+ return '\n'.join(line
+ if re.match(r'\s*\d*\s*\|', line)
+ else ' '.join(w for w in line.split())
+ for line in s.split('\n'))
+
test('WerrorFail', normal, compile_fail, [''])
-test('CaretDiagnostics1', normal, compile_fail, ['-fdiagnostics-show-caret -ferror-spans'])
+test('CaretDiagnostics1',
+ [normalise_whitespace_fun(normalise_whitespace_carefully)],
+ compile_fail,
+ ['-fdiagnostics-show-caret -ferror-spans'])
test('CaretDiagnostics2', normal, compile_fail, ['-fdiagnostics-show-caret'])