diff options
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/ghci/scripts/T8305.script | 39 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/T8305.stdout | 5 | ||||
-rwxr-xr-x | testsuite/tests/ghci/scripts/all.T | 1 |
3 files changed, 45 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/T8305.script b/testsuite/tests/ghci/scripts/T8305.script new file mode 100644 index 0000000000..2b5bc80006 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T8305.script @@ -0,0 +1,39 @@ +-- 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 () diff --git a/testsuite/tests/ghci/scripts/T8305.stdout b/testsuite/tests/ghci/scripts/T8305.stdout new file mode 100644 index 0000000000..691ed95c73 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T8305.stdout @@ -0,0 +1,5 @@ +called :type macro +() :: * +called :type macro +() :: * +called :time macro diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index dedca954f2..aaefca532e 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -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']) |