comparison src/testdir/test_vim9_expr.vim @ 19856:90eec641cc8c v8.2.0484

patch 8.2.0484: Vim9: some error messages not tested Commit: https://github.com/vim/vim/commit/92dba36fc8742fdb51b16d9bb967ef184b4babc1 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Mar 30 21:22:56 2020 +0200 patch 8.2.0484: Vim9: some error messages not tested Problem: Vim9: some error messages not tested. Solution: Add more tests.
author Bram Moolenaar <Bram@vim.org>
date Mon, 30 Mar 2020 21:30:04 +0200
parents eddc81783052
children 37c4779ca8f5
comparison
equal deleted inserted replaced
19855:520dedb83f15 19856:90eec641cc8c
520 call CheckDefFailure("let x = 0z1122 + [3]", 'E1035') 520 call CheckDefFailure("let x = 0z1122 + [3]", 'E1035')
521 call CheckDefFailure("let x = 0z1122 + 'asd'", 'E1035') 521 call CheckDefFailure("let x = 0z1122 + 'asd'", 'E1035')
522 call CheckDefFailure("let x = 33 + 0z1122", 'E1035') 522 call CheckDefFailure("let x = 33 + 0z1122", 'E1035')
523 call CheckDefFailure("let x = [3] + 0z1122", 'E1035') 523 call CheckDefFailure("let x = [3] + 0z1122", 'E1035')
524 call CheckDefFailure("let x = 'asdf' + 0z1122", 'E1035') 524 call CheckDefFailure("let x = 'asdf' + 0z1122", 'E1035')
525 call CheckDefFailure("let x = 6 + xxx", 'E1001')
525 endfunc 526 endfunc
526 527
527 " test multiply, divide, modulo 528 " test multiply, divide, modulo
528 def Test_expr6() 529 def Test_expr6()
529 assert_equal(36, 6 * 6) 530 assert_equal(36, 6 * 6)
551 let xf = [2.0] 552 let xf = [2.0]
552 let yf = [3.0] 553 let yf = [3.0]
553 assert_equal(5.0, xf[0] + yf[0]) 554 assert_equal(5.0, xf[0] + yf[0])
554 assert_equal(6.0, xf[0] * yf[0]) 555 assert_equal(6.0, xf[0] * yf[0])
555 endif 556 endif
557
558 call CheckDefFailure("let x = 6 * xxx", 'E1001')
556 enddef 559 enddef
557 560
558 def Test_expr6_float() 561 def Test_expr6_float()
559 if !has('float') 562 if !has('float')
560 MissingFeature 'float' 563 MissingFeature 'float'
678 def Test_expr7_blob() 681 def Test_expr7_blob()
679 " blob constant 682 " blob constant
680 assert_equal(g:blob_empty, 0z) 683 assert_equal(g:blob_empty, 0z)
681 assert_equal(g:blob_one, 0z01) 684 assert_equal(g:blob_one, 0z01)
682 assert_equal(g:blob_long, 0z0102.0304) 685 assert_equal(g:blob_long, 0z0102.0304)
686
687 call CheckDefFailure("let x = 0z123", 'E973:')
683 enddef 688 enddef
684 689
685 def Test_expr7_string() 690 def Test_expr7_string()
686 " string constant 691 " string constant
687 assert_equal(g:string_empty, '') 692 assert_equal(g:string_empty, '')
689 assert_equal(g:string_short, 'x') 694 assert_equal(g:string_short, 'x')
690 assert_equal(g:string_short, "x") 695 assert_equal(g:string_short, "x")
691 assert_equal(g:string_long, 'abcdefghijklm') 696 assert_equal(g:string_long, 'abcdefghijklm')
692 assert_equal(g:string_long, "abcdefghijklm") 697 assert_equal(g:string_long, "abcdefghijklm")
693 assert_equal(g:string_special, "ab\ncd\ref\ekk") 698 assert_equal(g:string_special, "ab\ncd\ref\ekk")
699
700 call CheckDefFailure('let x = "abc', 'E114:')
701 call CheckDefFailure("let x = 'abc", 'E115:')
694 enddef 702 enddef
695 703
696 def Test_expr7_special() 704 def Test_expr7_special()
697 " special constant 705 " special constant
698 assert_equal(g:special_true, true) 706 assert_equal(g:special_true, true)
736 call CheckDefFailure("let x = #{xxx: 1", 'E722:') 744 call CheckDefFailure("let x = #{xxx: 1", 'E722:')
737 call CheckDefFailure("let x = #{xxx: 1,", 'E723:') 745 call CheckDefFailure("let x = #{xxx: 1,", 'E723:')
738 call CheckDefFailure("let x = {'a': xxx}", 'E1001:') 746 call CheckDefFailure("let x = {'a': xxx}", 'E1001:')
739 call CheckDefFailure("let x = {xxx: 8}", 'E1001:') 747 call CheckDefFailure("let x = {xxx: 8}", 'E1001:')
740 call CheckDefFailure("let x = #{a: 1, a: 2}", 'E721:') 748 call CheckDefFailure("let x = #{a: 1, a: 2}", 'E721:')
749 call CheckDefFailure("let x = #", 'E1015:')
741 call CheckDefFailure("let x += 1", 'E1020:') 750 call CheckDefFailure("let x += 1", 'E1020:')
742 call CheckDefFailure("let x = x + 1", 'E1001:') 751 call CheckDefFailure("let x = x + 1", 'E1001:')
743 call CheckDefExecFailure("let x = g:anint.member", 'E715:') 752 call CheckDefExecFailure("let x = g:anint.member", 'E715:')
744 call CheckDefExecFailure("let x = g:dict_empty.member", 'E716:') 753 call CheckDefExecFailure("let x = g:dict_empty.member", 'E716:')
745 enddef 754 enddef