From 44f871a3cb7b0d40ebef0210d0e7cccf8ecdcda9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 19 Jul 2024 12:55:55 +0800 Subject: vim-patch:9.1.0558: filetype: prolog detection can be improved Problem: filetype: prolog detection can be improved Solution: Improved the Prolog file detection regex and added tests for all cases. (igna_martinoli) fixes: vim/vim#10835 closes: vim/vim#15206 https://github.com/vim/vim/commit/50dc83cf9215aa787da54abbb0bd2ab4fb89e720 Only include the tests, as code changes are superseded by later patches. Co-authored-by: igna_martinoli --- test/old/testdir/test_filetype.vim | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 3dff957cd5..aa522c3098 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -2576,4 +2576,31 @@ func Test_uci_file() filetype off endfunc +func Test_pro_file() + filetype on + + "Prolog + call writefile([':-module(test/1,'], 'Xfile.pro', 'D') + split Xfile.pro + call assert_equal('prolog', &filetype) + bwipe! + + call writefile(['% comment'], 'Xfile.pro', 'D') + split Xfile.pro + call assert_equal('prolog', &filetype) + bwipe! + + call writefile(['/* multiline comment'], 'Xfile.pro', 'D') + split Xfile.pro + call assert_equal('prolog', &filetype) + bwipe! + + call writefile(['rule(test, 1.7).'], 'Xfile.pro', 'D') + split Xfile.pro + call assert_equal('prolog', &filetype) + bwipe! + + filetype off +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit From f67a7365afacfad3f05e7aaca0bb2538a6e9f125 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 19 Jul 2024 12:57:56 +0800 Subject: vim-patch:9.1.0602: filetype: Prolog detection can be improved Problem: filetype: Prolog detection can be improved Solution: update the prolog detection regex (igna_martinoli) related: vim/vim#10835 related: vim/vim#15206 closes: vim/vim#15253 https://github.com/vim/vim/commit/37853b7de31ef34153fe76aa2b740d517ed0e5d4 N/A patch: vim-patch:7347642: runtime(filetype): Fix Prolog file detection regex Problem: filetype: .pro file detection for Prolog is broken Solution: fixed the regex to only match on the tested cases (igna_martinoli) fixes: vim/vim#10835 closes: vim/vim#15206 https://github.com/vim/vim/commit/7347642633eb2de23a78c51a4388c9080440eec4 Co-authored-by: igna_martinoli Co-authored-by: clason --- test/old/testdir/test_filetype.vim | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index aa522c3098..ba7836cd4f 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -2600,6 +2600,44 @@ func Test_pro_file() call assert_equal('prolog', &filetype) bwipe! + " IDL + call writefile(['x = findgen(100)/10'], 'Xfile.pro', 'D') + split Xfile.pro + call assert_equal('idlang', &filetype) + + filetype off +endfunc + + +func Test_pl_file() + filetype on + + "Prolog + call writefile([':-module(test/1,'], 'Xfile.pl', 'D') + split Xfile.pl + call assert_equal('prolog', &filetype) + bwipe! + + call writefile(['% comment'], 'Xfile.pl', 'D') + split Xfile.pl + call assert_equal('prolog', &filetype) + bwipe! + + call writefile(['/* multiline comment'], 'Xfile.pl', 'D') + split Xfile.pl + call assert_equal('prolog', &filetype) + bwipe! + + call writefile(['rule(test, 1.7).'], 'Xfile.pl', 'D') + split Xfile.pl + call assert_equal('prolog', &filetype) + bwipe! + + " Perl + call writefile(['%data = (1, 2, 3);'], 'Xfile.pl', 'D') + split Xfile.pl + call assert_equal('perl', &filetype) + filetype off endfunc -- cgit