• R/O
  • SSH

vim: 提交

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

修訂e4ade28bfaf7d1748e19e38dc5a3f619533c824c (tree)
時間2020-03-30 01:45:03
作者Bram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.2.0477: Vim9: error messages not tested

Commit: https://github.com/vim/vim/commit/c58164c5cff9845f3bf7cfcd75ace43208829388
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 29 18:40:30 2020 +0200

patch 8.2.0477: Vim9: error messages not tested
Problem: Vim9: error messages not tested.
Solution: Add more tests.

Change Summary

差異

diff -r ff9fa9cc6e2e -r e4ade28bfaf7 src/testdir/test_vim9_expr.vim
--- a/src/testdir/test_vim9_expr.vim Sun Mar 29 18:00:04 2020 +0200
+++ b/src/testdir/test_vim9_expr.vim Sun Mar 29 18:45:03 2020 +0200
@@ -728,6 +728,13 @@
728728 let val = 1
729729 assert_equal(g:dict_one, {key: val})
730730
731+ call CheckDefFailure("let x = #{8: 8}", 'E1014:')
732+ call CheckDefFailure("let x = #{xxx}", 'E720:')
733+ call CheckDefFailure("let x = #{xxx: 1", 'E722:')
734+ call CheckDefFailure("let x = #{xxx: 1,", 'E723:')
735+ call CheckDefFailure("let x = {'a': xxx}", 'E1001:')
736+ call CheckDefFailure("let x = {xxx: 8}", 'E1001:')
737+ call CheckDefFailure("let x = #{a: 1, a: 2}", 'E721:')
731738 call CheckDefExecFailure("let x = g:anint.member", 'E715:')
732739 call CheckDefExecFailure("let x = g:dict_empty.member", 'E716:')
733740 enddef
@@ -750,6 +757,8 @@
750757 " environment variable
751758 assert_equal('testvar', $TESTVAR)
752759 assert_equal('', $ASDF_ASD_XXX)
760+
761+ call CheckDefFailure("let x = $$$", 'E1002:')
753762 enddef
754763
755764 def Test_expr7_register()
@@ -802,6 +811,9 @@
802811
803812 call CheckDefFailure("let x = -'xx'", "E1030:")
804813 call CheckDefFailure("let x = +'xx'", "E1030:")
814+ call CheckDefFailure("let x = -0z12", "E974:")
815+ call CheckDefExecFailure("let x = -[8]", "E39:")
816+ call CheckDefExecFailure("let x = -{'a': 1}", "E39:")
805817
806818 call CheckDefFailure("let x = @", "E1002:")
807819 call CheckDefFailure("let x = @<", "E354:")
diff -r ff9fa9cc6e2e -r e4ade28bfaf7 src/version.c
--- a/src/version.c Sun Mar 29 18:00:04 2020 +0200
+++ b/src/version.c Sun Mar 29 18:45:03 2020 +0200
@@ -739,6 +739,8 @@
739739 static int included_patches[] =
740740 { /* Add new patch number below this line */
741741 /**/
742+ 477,
743+/**/
742744 476,
743745 /**/
744746 475,
diff -r ff9fa9cc6e2e -r e4ade28bfaf7 src/vim9execute.c
--- a/src/vim9execute.c Sun Mar 29 18:00:04 2020 +0200
+++ b/src/vim9execute.c Sun Mar 29 18:45:03 2020 +0200
@@ -1612,7 +1612,21 @@
16121612
16131613 case ISN_NEGATENR:
16141614 tv = STACK_TV_BOT(-1);
1615- tv->vval.v_number = -tv->vval.v_number;
1615+ if (tv->v_type != VAR_NUMBER
1616+#ifdef FEAT_FLOAT
1617+ && tv->v_type != VAR_FLOAT
1618+#endif
1619+ )
1620+ {
1621+ emsg(_(e_number_exp));
1622+ goto failed;
1623+ }
1624+#ifdef FEAT_FLOAT
1625+ if (tv->v_type == VAR_FLOAT)
1626+ tv->vval.v_float = -tv->vval.v_float;
1627+ else
1628+#endif
1629+ tv->vval.v_number = -tv->vval.v_number;
16161630 break;
16171631
16181632 case ISN_CHECKNR:
Show on old repository browser