Mercurial > vim
annotate src/testdir/test_glob2regpat.vim @ 27084:6fc63c6a7ee7 v8.2.4071
patch 8.2.4071: Vim9: no detection of return in try/endtry
Commit: https://github.com/vim/vim/commit/53c296112edd8471eb63afbca03f96bad164c813
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jan 12 16:18:18 2022 +0000
patch 8.2.4071: Vim9: no detection of return in try/endtry
Problem: Vim9: no detection of return in try/endtry. (Dominique Pell?)
Solution: Check if any of the blocks inside try/endtry did not end in
return.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 12 Jan 2022 17:30:07 +0100 |
parents | a07323eb647f |
children | 4c16acb2525f |
rev | line source |
---|---|
7767
c9daa07abf34
commit https://github.com/vim/vim/commit/ac80999985299dae4a9ef56dbf31fbdb35c04c08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test glob2regpat() |
c9daa07abf34
commit https://github.com/vim/vim/commit/ac80999985299dae4a9ef56dbf31fbdb35c04c08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
24822
5f8dd7b3ae41
patch 8.2.2949: tests failing because no error for float to string conversion
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
3 source vim9.vim |
5f8dd7b3ae41
patch 8.2.2949: tests failing because no error for float to string conversion
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
4 |
14383
8846b8344430
patch 8.1.0206: duplicate test function name
Christian Brabandt <cb@256bit.org>
parents:
9842
diff
changeset
|
5 func Test_glob2regpat_invalid() |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
6 if has('float') |
24822
5f8dd7b3ae41
patch 8.2.2949: tests failing because no error for float to string conversion
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
7 call assert_equal('^1\.33$', glob2regpat(1.33)) |
26650
a07323eb647f
patch 8.2.3854: Vim9: inconsistent arguments for test functions
Bram Moolenaar <Bram@vim.org>
parents:
25384
diff
changeset
|
8 call CheckDefAndScriptFailure(['echo glob2regpat(1.2)'], ['E1013: Argument 1: type mismatch, expected string but got float', 'E1174: String required for argument 1']) |
19249
2a017e9dc6da
patch 8.2.0183: tests fail when the float feature is disabled
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
9 endif |
9820
6882920b42da
commit https://github.com/vim/vim/commit/71dd9744cf3842cd45295010d2e5692da1651537
Christian Brabandt <cb@256bit.org>
parents:
7767
diff
changeset
|
10 call assert_fails('call glob2regpat("}")', 'E219:') |
6882920b42da
commit https://github.com/vim/vim/commit/71dd9744cf3842cd45295010d2e5692da1651537
Christian Brabandt <cb@256bit.org>
parents:
7767
diff
changeset
|
11 call assert_fails('call glob2regpat("{")', 'E220:') |
7767
c9daa07abf34
commit https://github.com/vim/vim/commit/ac80999985299dae4a9ef56dbf31fbdb35c04c08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 endfunc |
c9daa07abf34
commit https://github.com/vim/vim/commit/ac80999985299dae4a9ef56dbf31fbdb35c04c08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 |
14383
8846b8344430
patch 8.1.0206: duplicate test function name
Christian Brabandt <cb@256bit.org>
parents:
9842
diff
changeset
|
14 func Test_glob2regpat_valid() |
7767
c9daa07abf34
commit https://github.com/vim/vim/commit/ac80999985299dae4a9ef56dbf31fbdb35c04c08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 call assert_equal('^foo\.', glob2regpat('foo.*')) |
17912
9fac6d0de69a
patch 8.1.1952: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
14383
diff
changeset
|
16 call assert_equal('^foo.$', 'foo?'->glob2regpat()) |
7767
c9daa07abf34
commit https://github.com/vim/vim/commit/ac80999985299dae4a9ef56dbf31fbdb35c04c08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 call assert_equal('\.vim$', glob2regpat('*.vim')) |
9820
6882920b42da
commit https://github.com/vim/vim/commit/71dd9744cf3842cd45295010d2e5692da1651537
Christian Brabandt <cb@256bit.org>
parents:
7767
diff
changeset
|
18 call assert_equal('^[abc]$', glob2regpat('[abc]')) |
6882920b42da
commit https://github.com/vim/vim/commit/71dd9744cf3842cd45295010d2e5692da1651537
Christian Brabandt <cb@256bit.org>
parents:
7767
diff
changeset
|
19 call assert_equal('^foo bar$', glob2regpat('foo\ bar')) |
6882920b42da
commit https://github.com/vim/vim/commit/71dd9744cf3842cd45295010d2e5692da1651537
Christian Brabandt <cb@256bit.org>
parents:
7767
diff
changeset
|
20 call assert_equal('^foo,bar$', glob2regpat('foo,bar')) |
6882920b42da
commit https://github.com/vim/vim/commit/71dd9744cf3842cd45295010d2e5692da1651537
Christian Brabandt <cb@256bit.org>
parents:
7767
diff
changeset
|
21 call assert_equal('^\(foo\|bar\)$', glob2regpat('{foo,bar}')) |
6882920b42da
commit https://github.com/vim/vim/commit/71dd9744cf3842cd45295010d2e5692da1651537
Christian Brabandt <cb@256bit.org>
parents:
7767
diff
changeset
|
22 call assert_equal('.*', glob2regpat('**')) |
9824
0524e72c9023
commit https://github.com/vim/vim/commit/7547a78446c1a3c04b36c0533f0f046188bd378b
Christian Brabandt <cb@256bit.org>
parents:
9820
diff
changeset
|
23 |
9842
f8396c6e5709
commit https://github.com/vim/vim/commit/91c5262b19fd2e558fe87b78c7767c7c5a270be8
Christian Brabandt <cb@256bit.org>
parents:
9824
diff
changeset
|
24 if exists('+shellslash') |
f8396c6e5709
commit https://github.com/vim/vim/commit/91c5262b19fd2e558fe87b78c7767c7c5a270be8
Christian Brabandt <cb@256bit.org>
parents:
9824
diff
changeset
|
25 call assert_equal('^foo[\/].$', glob2regpat('foo\?')) |
f8396c6e5709
commit https://github.com/vim/vim/commit/91c5262b19fd2e558fe87b78c7767c7c5a270be8
Christian Brabandt <cb@256bit.org>
parents:
9824
diff
changeset
|
26 call assert_equal('^\(foo[\/]\|bar\|foobar\)$', glob2regpat('{foo\,bar,foobar}')) |
f8396c6e5709
commit https://github.com/vim/vim/commit/91c5262b19fd2e558fe87b78c7767c7c5a270be8
Christian Brabandt <cb@256bit.org>
parents:
9824
diff
changeset
|
27 call assert_equal('^[\/]\(foo\|bar[\/]\)$', glob2regpat('\{foo,bar\}')) |
f8396c6e5709
commit https://github.com/vim/vim/commit/91c5262b19fd2e558fe87b78c7767c7c5a270be8
Christian Brabandt <cb@256bit.org>
parents:
9824
diff
changeset
|
28 call assert_equal('^[\/][\/]\(foo\|bar[\/][\/]\)$', glob2regpat('\\{foo,bar\\}')) |
f8396c6e5709
commit https://github.com/vim/vim/commit/91c5262b19fd2e558fe87b78c7767c7c5a270be8
Christian Brabandt <cb@256bit.org>
parents:
9824
diff
changeset
|
29 else |
9824
0524e72c9023
commit https://github.com/vim/vim/commit/7547a78446c1a3c04b36c0533f0f046188bd378b
Christian Brabandt <cb@256bit.org>
parents:
9820
diff
changeset
|
30 call assert_equal('^foo?$', glob2regpat('foo\?')) |
0524e72c9023
commit https://github.com/vim/vim/commit/7547a78446c1a3c04b36c0533f0f046188bd378b
Christian Brabandt <cb@256bit.org>
parents:
9820
diff
changeset
|
31 call assert_equal('^\(foo,bar\|foobar\)$', glob2regpat('{foo\,bar,foobar}')) |
0524e72c9023
commit https://github.com/vim/vim/commit/7547a78446c1a3c04b36c0533f0f046188bd378b
Christian Brabandt <cb@256bit.org>
parents:
9820
diff
changeset
|
32 call assert_equal('^{foo,bar}$', glob2regpat('\{foo,bar\}')) |
0524e72c9023
commit https://github.com/vim/vim/commit/7547a78446c1a3c04b36c0533f0f046188bd378b
Christian Brabandt <cb@256bit.org>
parents:
9820
diff
changeset
|
33 call assert_equal('^\\\(foo\|bar\\\)$', glob2regpat('\\{foo,bar\\}')) |
0524e72c9023
commit https://github.com/vim/vim/commit/7547a78446c1a3c04b36c0533f0f046188bd378b
Christian Brabandt <cb@256bit.org>
parents:
9820
diff
changeset
|
34 endif |
7767
c9daa07abf34
commit https://github.com/vim/vim/commit/ac80999985299dae4a9ef56dbf31fbdb35c04c08
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
36 |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
19249
diff
changeset
|
37 " vim: shiftwidth=2 sts=2 expandtab |