diff options
author | nineonine <mail4chemik@gmail.com> | 2022-01-28 00:29:01 -0800 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-02-05 19:21:49 -0500 |
commit | 299acff08aa1b7b720ad2b69c459c514033bc395 (patch) | |
tree | 12cf8090a0b6a405b49a29aeefa47a24f3883452 /testsuite/tests/ghc-e | |
parent | 6af8e71ed7e749ba94e7a7eaf8b2229341bf35da (diff) | |
download | haskell-299acff08aa1b7b720ad2b69c459c514033bc395.tar.gz |
Exit with failure when -e fails (fixes #18411 #9916 #17560)
Diffstat (limited to 'testsuite/tests/ghc-e')
26 files changed, 157 insertions, 6 deletions
diff --git a/testsuite/tests/ghc-e/should_fail/Makefile b/testsuite/tests/ghc-e/should_fail/Makefile index 827dfc776a..627d85fe43 100644 --- a/testsuite/tests/ghc-e/should_fail/Makefile +++ b/testsuite/tests/ghc-e/should_fail/Makefile @@ -3,22 +3,76 @@ include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk T7962: - -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "return (" + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "return (" || echo $$? >&2 T9905fail1: - -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import This.Module.Does.Not.Exist" + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import This.Module.Does.Not.Exist" || echo $$? >&2 T9905fail2: - -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import Data.List (bogusIdentifier)" + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import Data.List (bogusIdentifier)" || echo $$? >&2 T9905fail3: - -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import Prelude (+)" # syntax error + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import Prelude (+)" || echo $$? >&2 # syntax error ghc-e-fail1: - -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "class [" + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "class [" || echo $$? >&2 ghc-e-fail2: - -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "type A = A" + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "type A = A" || echo $$? >&2 T9930fail: -'$(TEST_HC)' $(TEST_HC_OPTS) -v0 -x hs T9930 + +T18441fail0: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":" || echo $$? >&2 + +T18441fail1: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":abcde" || echo $$? >&2 + +T18441fail2: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":set -Xabcde" || echo $$? >&2 # unrecognized flag + +T18441fail4: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":load Abcde" || echo $$? >&2 # no module + +T18441fail5: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":reload Abcde" || echo $$? >&2 # no module + +T18441fail6: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":add Abcde" || echo $$? >&2 # no module + +T18441fail7: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":script Abcde" || echo $$? >&2 # no script + +T18441fail8: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":script Abc def" || echo $$? >&2 # bad script input + +T18441fail9: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":def abc" || echo $$? >&2 # macro not an expr + +T18441fail10: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":def :abc" || echo $$? >&2 # bad macro + +T18441fail11: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":def !abc" || echo $$? >&2 # bad macro + +T18441fail12: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":cmd abc" || echo $$? >&2 # cmd compilation failure + +T18441fail13: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":t" || echo $$? >&2 + +T18441fail14: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":type-at H.hs 1 1 1 1 f" || echo $$? >&2 + +T18441fail15: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":loc-at H.hs 1 1 1 1 f" || echo $$? >&2 + +T18441fail16: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":k" || echo $$? >&2 + +T18441fail17: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":run a" || echo $$? >&2 + +T18441fail18: + -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":main" || echo $$? >&2 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail0.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail0.stderr new file mode 100644 index 0000000000..1918b09df9 --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail0.stderr @@ -0,0 +1,3 @@ +there is no last command to perform +use :? for help. +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail1.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail1.stderr new file mode 100644 index 0000000000..10d382d050 --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail1.stderr @@ -0,0 +1,3 @@ +unknown command ':abcde' +use :? for help. +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail10.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail10.stderr new file mode 100644 index 0000000000..2e71b287e3 --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail10.stderr @@ -0,0 +1,2 @@ +macro name cannot start with a colon +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail11.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail11.stderr new file mode 100644 index 0000000000..298e204c62 --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail11.stderr @@ -0,0 +1,2 @@ +macro name cannot start with an exclamation mark +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail12.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail12.stderr new file mode 100644 index 0000000000..38ea987f38 --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail12.stderr @@ -0,0 +1,5 @@ + +<interactive>:1:1: error: + Variable not in scope: abc :: IO String + Suggested fix: Perhaps use ‘abs’ (imported from Prelude) +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail13.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail13.stderr new file mode 100644 index 0000000000..35f740c0a9 --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail13.stderr @@ -0,0 +1,3 @@ + +<no location info>: error: not an expression: ‘’ +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail14.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail14.stderr new file mode 100644 index 0000000000..c1515dae77 --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail14.stderr @@ -0,0 +1,2 @@ +Couldn't guess that module name. Does it exist? +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail15.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail15.stderr new file mode 100644 index 0000000000..c1515dae77 --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail15.stderr @@ -0,0 +1,2 @@ +Couldn't guess that module name. Does it exist? +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail16.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail16.stderr new file mode 100644 index 0000000000..2194e5f81b --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail16.stderr @@ -0,0 +1,4 @@ + +<interactive>:1:1: error: + parse error (possibly incorrect indentation or mismatched brackets) +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail17.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail17.stderr new file mode 100644 index 0000000000..d0749cc833 --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail17.stderr @@ -0,0 +1,3 @@ + +<interactive>:0:33: error: Variable not in scope: a :: IO a +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail18.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail18.stderr new file mode 100644 index 0000000000..9981715a36 --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail18.stderr @@ -0,0 +1,5 @@ + +<interactive>:0:53: error: + Variable not in scope: main :: IO a0 + Suggested fix: Perhaps use ‘min’ (imported from Prelude) +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail2.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail2.stderr new file mode 100644 index 0000000000..849747f5eb --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail2.stderr @@ -0,0 +1,2 @@ +<interactive>: Some flags have not been recognized: -Xabcde +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail4.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail4.stderr new file mode 100644 index 0000000000..91e20fe8f1 --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail4.stderr @@ -0,0 +1,3 @@ + +<no location info>: error: module ‘Abcde’ cannot be found locally +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail5.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail5.stderr new file mode 100644 index 0000000000..05578a2262 --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail5.stderr @@ -0,0 +1,3 @@ + +<no location info>: error: no such module: ‘main:Abcde’ +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail6.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail6.stderr new file mode 100644 index 0000000000..6979f8d919 --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail6.stderr @@ -0,0 +1,2 @@ +Module Abcde not found +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail7.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail7.stderr new file mode 100644 index 0000000000..aaf284760a --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail7.stderr @@ -0,0 +1,2 @@ +<interactive>: IO error: "Abcde" does not exist +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail8.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail8.stderr new file mode 100644 index 0000000000..80b40ae5f5 --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail8.stderr @@ -0,0 +1,2 @@ +<interactive>: syntax: :script <filename> +1 diff --git a/testsuite/tests/ghc-e/should_fail/T18441fail9.stderr b/testsuite/tests/ghc-e/should_fail/T18441fail9.stderr new file mode 100644 index 0000000000..35f740c0a9 --- /dev/null +++ b/testsuite/tests/ghc-e/should_fail/T18441fail9.stderr @@ -0,0 +1,3 @@ + +<no location info>: error: not an expression: ‘’ +1 diff --git a/testsuite/tests/ghc-e/should_fail/T7962.stderr b/testsuite/tests/ghc-e/should_fail/T7962.stderr index b58aa89502..cf1fdb92be 100644 --- a/testsuite/tests/ghc-e/should_fail/T7962.stderr +++ b/testsuite/tests/ghc-e/should_fail/T7962.stderr @@ -1,3 +1,4 @@ <interactive>:0:9: error: parse error (possibly incorrect indentation or mismatched brackets) +1 diff --git a/testsuite/tests/ghc-e/should_fail/T9905fail1.stderr b/testsuite/tests/ghc-e/should_fail/T9905fail1.stderr index 1f0fb05138..9d0d79c23e 100644 --- a/testsuite/tests/ghc-e/should_fail/T9905fail1.stderr +++ b/testsuite/tests/ghc-e/should_fail/T9905fail1.stderr @@ -2,3 +2,4 @@ <no location info>: error: Could not find module ‘This.Module.Does.Not.Exist’ It is not a module in the current program, or in any known package. +1 diff --git a/testsuite/tests/ghc-e/should_fail/T9905fail2.stderr b/testsuite/tests/ghc-e/should_fail/T9905fail2.stderr index 9143eccae4..8be6c2aadb 100644 --- a/testsuite/tests/ghc-e/should_fail/T9905fail2.stderr +++ b/testsuite/tests/ghc-e/should_fail/T9905fail2.stderr @@ -1,3 +1,4 @@ <interactive>:0:19: error: Module ‘Data.List’ does not export ‘bogusIdentifier’ +1 diff --git a/testsuite/tests/ghc-e/should_fail/T9905fail3.stderr b/testsuite/tests/ghc-e/should_fail/T9905fail3.stderr index 85226ea2b4..de9de0b88f 100644 --- a/testsuite/tests/ghc-e/should_fail/T9905fail3.stderr +++ b/testsuite/tests/ghc-e/should_fail/T9905fail3.stderr @@ -1,2 +1,3 @@ <interactive>:0:17: error: parse error on input ‘+’ +1 diff --git a/testsuite/tests/ghc-e/should_fail/all.T b/testsuite/tests/ghc-e/should_fail/all.T index 76f9afe0a8..7196bbe969 100644 --- a/testsuite/tests/ghc-e/should_fail/all.T +++ b/testsuite/tests/ghc-e/should_fail/all.T @@ -14,3 +14,43 @@ test('ghc-e-fail2', req_interp, makefile_test, ['ghc-e-fail2']) # and no failure is induced. test('T9930fail', [extra_files(['T9930']), when(opsys('mingw32'), skip)], makefile_test, ['T9930fail']) + +test('T18441fail0', req_interp, makefile_test, ['T18441fail0']) + +test('T18441fail1', req_interp, makefile_test, ['T18441fail1']) + +test('T18441fail2', req_interp, makefile_test, ['T18441fail2']) + +test('T18441fail3', [ignore_stderr, exit_code(1)], run_command, ['{compiler} -e ":! abcde"']) + +test('T18441fail4', req_interp, makefile_test, ['T18441fail4']) + +test('T18441fail5', req_interp, makefile_test, ['T18441fail5']) + +test('T18441fail6', req_interp, makefile_test, ['T18441fail6']) + +test('T18441fail7', req_interp, makefile_test, ['T18441fail7']) + +test('T18441fail8', req_interp, makefile_test, ['T18441fail8']) + +test('T18441fail9', req_interp, makefile_test, ['T18441fail9']) + +test('T18441fail10', req_interp, makefile_test, ['T18441fail10']) + +test('T18441fail11', req_interp, makefile_test, ['T18441fail11']) + +test('T18441fail12', req_interp, makefile_test, ['T18441fail12']) + +test('T18441fail13', req_interp, makefile_test, ['T18441fail13']) + +test('T18441fail14', req_interp, makefile_test, ['T18441fail14']) + +test('T18441fail15', req_interp, makefile_test, ['T18441fail15']) + +test('T18441fail16', req_interp, makefile_test, ['T18441fail16']) + +test('T18441fail17', req_interp, makefile_test, ['T18441fail17']) + +test('T18441fail18', req_interp, makefile_test, ['T18441fail18']) + +test('T18441fail19', [ignore_stderr, exit_code(1)], run_command, ['{compiler} -e ":cd abcd"']) diff --git a/testsuite/tests/ghc-e/should_fail/ghc-e-fail1.stderr b/testsuite/tests/ghc-e/should_fail/ghc-e-fail1.stderr index cf75b40644..d1f2d18251 100644 --- a/testsuite/tests/ghc-e/should_fail/ghc-e-fail1.stderr +++ b/testsuite/tests/ghc-e/should_fail/ghc-e-fail1.stderr @@ -1,3 +1,4 @@ <interactive>:0:8: error: parse error (possibly incorrect indentation or mismatched brackets) +1 diff --git a/testsuite/tests/ghc-e/should_fail/ghc-e-fail2.stderr b/testsuite/tests/ghc-e/should_fail/ghc-e-fail2.stderr index bcd0565d6a..858139c117 100644 --- a/testsuite/tests/ghc-e/should_fail/ghc-e-fail2.stderr +++ b/testsuite/tests/ghc-e/should_fail/ghc-e-fail2.stderr @@ -2,3 +2,4 @@ <interactive>:0:1: error: Cycle in type synonym declarations: <interactive>:0:1-10: type A = A +1 |