To: vim_dev@googlegroups.com Subject: Patch 8.2.0349 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0349 Problem: Vim9: constant expression not well tested. Solution: Add tests for "if" with constant expression. Files: src/testdir/test_vim9_script.vim *** ../vim-8.2.0348/src/testdir/test_vim9_script.vim 2020-03-02 22:53:28.460549750 +0100 --- src/testdir/test_vim9_script.vim 2020-03-03 19:01:04.278167190 +0100 *************** *** 732,737 **** --- 732,839 ---- assert_equal('three', IfElse(3)) enddef + let g:bool_true = v:true + let g:bool_false = v:false + + def Test_if_const_expr() + let res = false + if true ? true : false + res = true + endif + assert_equal(true, res) + + res = false + if g:bool_true ? true : false + res = true + endif + assert_equal(true, res) + + res = false + if true ? g:bool_true : false + res = true + endif + assert_equal(true, res) + + res = false + if true ? true : g:bool_false + res = true + endif + assert_equal(true, res) + + res = false + if true ? false : true + res = true + endif + assert_equal(false, res) + + res = false + if false ? false : true + res = true + endif + assert_equal(true, res) + + res = false + if false ? true : false + res = true + endif + assert_equal(false, res) + + res = false + if true && true + res = true + endif + assert_equal(true, res) + + res = false + if true && false + res = true + endif + assert_equal(false, res) + + res = false + if g:bool_true && false + res = true + endif + assert_equal(false, res) + + res = false + if true && g:bool_false + res = true + endif + assert_equal(false, res) + + res = false + if false && false + res = true + endif + assert_equal(false, res) + + res = false + if true || false + res = true + endif + assert_equal(true, res) + + res = false + if g:bool_true || false + res = true + endif + assert_equal(true, res) + + res = false + if true || g:bool_false + res = true + endif + assert_equal(true, res) + + res = false + if false || false + res = true + endif + assert_equal(false, res) + + enddef + def Test_delfunc() let lines =<< trim END vim9script *** ../vim-8.2.0348/src/version.c 2020-03-02 22:53:28.460549750 +0100 --- src/version.c 2020-03-03 18:53:34.759841215 +0100 *************** *** 740,741 **** --- 740,743 ---- { /* Add new patch number below this line */ + /**/ + 349, /**/ -- "Hit any key to continue" is a lie. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///