Mercurial > vim
comparison src/testdir/test_vim9_expr.vim @ 28029:0ed38a4e028d v8.2.4539
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Commit: https://github.com/vim/vim/commit/53ba6ca5b27248680e368340707ad4b32a82591f
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 10 19:23:28 2022 +0000
patch 8.2.4539: when comparing special v:none and v:null are handled the same
Problem: When comparing special v:none and v:null are handled the same when
compiling.
Solution: Pass more information so that v:none can be handled differently at
compile time. (issue #9923)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 10 Mar 2022 20:30:04 +0100 |
parents | 53e2bf6032e5 |
children | 4aa79224acd2 |
comparison
equal
deleted
inserted
replaced
28028:db86841e8419 | 28029:0ed38a4e028d |
---|---|
826 v9.CheckDefAndScriptFailure(['echo true == v:null'], 'E1072: Cannot compare bool with special') | 826 v9.CheckDefAndScriptFailure(['echo true == v:null'], 'E1072: Cannot compare bool with special') |
827 v9.CheckDefAndScriptFailure(['echo v:null == true'], 'E1072: Cannot compare special with bool') | 827 v9.CheckDefAndScriptFailure(['echo v:null == true'], 'E1072: Cannot compare special with bool') |
828 v9.CheckDefAndScriptFailure(['echo true != v:null'], 'E1072: Cannot compare bool with special') | 828 v9.CheckDefAndScriptFailure(['echo true != v:null'], 'E1072: Cannot compare bool with special') |
829 v9.CheckDefAndScriptFailure(['echo v:null != true'], 'E1072: Cannot compare special with bool') | 829 v9.CheckDefAndScriptFailure(['echo v:null != true'], 'E1072: Cannot compare special with bool') |
830 v9.CheckDefAndScriptFailure(['echo false == v:null'], 'E1072: Cannot compare bool with special') | 830 v9.CheckDefAndScriptFailure(['echo false == v:null'], 'E1072: Cannot compare bool with special') |
831 | 831 enddef |
832 v9.CheckDefExecAndScriptFailure(['echo [] == v:none'], ['E1072: Cannot compare list with special', 'E691: Can only compare List with List']) | 832 |
833 def Test_expr4_compare_none() | |
834 var lines =<< trim END | |
835 assert_false('' == v:none) | |
836 assert_false('text' == v:none) | |
837 assert_true(v:none == v:none) | |
838 assert_false(v:none == '') | |
839 assert_false(v:none == 'text') | |
840 assert_true(v:none == v:none) | |
841 END | |
842 v9.CheckDefAndScriptSuccess(lines) | |
843 | |
844 v9.CheckDefAndScriptFailure(['echo [] == v:none'], 'E1072: Cannot compare list with special') | |
845 v9.CheckDefAndScriptFailure(['echo 123 == v:none'], 'E1072: Cannot compare number with special') | |
846 v9.CheckDefAndScriptFailure(['echo 0z00 == v:none'], 'E1072: Cannot compare blob with special') | |
833 enddef | 847 enddef |
834 | 848 |
835 def Test_expr4_wrong_type() | 849 def Test_expr4_wrong_type() |
836 for op in ['>', '>=', '<', '<=', '=~', '!~'] | 850 for op in ['>', '>=', '<', '<=', '=~', '!~'] |
837 v9.CheckDefExecAndScriptFailure([ | 851 v9.CheckDefExecAndScriptFailure([ |