Commit 19641957 authored by Takenobu Tani's avatar Takenobu Tani Committed by Marge Bot

testsuite: Add test for #8305

This is a test for the current algorithm of GHCi command name resolution.

I add this test in preparation for updating GHCi command name resolution.

For the current algorithm, see https://downloads.haskell.org/ghc/latest/docs/html/users_guide/ghci.html#the-ghci-files
parent cc2bda50
Pipeline #11448 passed with stages
in 422 minutes and 59 seconds
-- Testing the current algorithm of command name resolution
-- The current algorithm of command name resolution is:
-- 1. First, look up an exact match on the name from the defined macros.
-- 2. Look for the exact match on the name in the built-in command list.
-- 3. Do a prefix lookup on the list of built-in commands
-- - if a built-in command matches, but a macro is defined
-- with the same name as the built-in defined, pick the macro.
-- 4. Do a prefix lookup on the list of built-in commands.
-- 5. Do a prefix lookup on the list of defined macros.
--
-- For the current algorithm, see https://downloads.haskell.org/ghc/latest/docs/html/users_guide/ghci.html#the-ghci-files
----- Defineing macros for test
:def! ty (\e -> putStrLn "called :ty macro" >> return "")
:def! type (\e -> putStrLn "called :type macro" >> return "")
:def type2 (\e -> putStrLn "called :type2 macro" >> return "")
:def time (\e -> putStrLn "called :time macro" >> return "")
:def! ki (\e -> putStrLn "called :ki macro" >> return "")
:def kind2 (\e -> putStrLn "called :kind2 macro" >> return "")
----- Testing
-- 1.
:type ()
-- 2.
:kind ()
-- 3.
:t ()
-- 4.
:k ()
-- 5.
:ti ()
called :type macro
() :: *
called :type macro
() :: *
called :time macro
......@@ -178,6 +178,7 @@ test('T8113', normal, ghci_script, ['T8113.script'])
test('T8172', when(opsys('mingw32'), normalise_drive_letter),
ghci_script, ['T8172.script'])
test('T8215', normal, ghci_script, ['T8215.script'])
test('T8305', normal, ghci_script, ['T8305.script'])
test('T8353', extra_files(['Defer03.hs']), ghci_script, ['T8353.script'])
test('T8357', normal, ghci_script, ['T8357.script'])
test('T8383', normal, ghci_script, ['T8383.script'])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment