aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_method.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/testdir/test_method.vim')
-rw-r--r--src/nvim/testdir/test_method.vim11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_method.vim b/src/nvim/testdir/test_method.vim
index 43ed830aba..ef87773924 100644
--- a/src/nvim/testdir/test_method.vim
+++ b/src/nvim/testdir/test_method.vim
@@ -49,6 +49,7 @@ func Test_dict()
" call assert_fails("let x = d->insert(0)", 'E899:')
call assert_fails("let x = d->index(2)", 'E714:')
call assert_fails("let x = d->insert(0)", 'E686:')
+ call assert_true(d->has_key('two'))
call assert_equal([['one', 1], ['two', 2], ['three', 3]], d->items())
call assert_fails("let x = d->join()", 'E714:')
call assert_equal(['one', 'two', 'three'], d->keys())
@@ -70,6 +71,16 @@ func Test_dict()
call assert_equal([1, 2, 3], d->values())
endfunc
+func Test_string()
+ call assert_equal(['1', '2', '3'], '1 2 3'->split())
+ call assert_equal([1, 2, 3], '1 2 3'->split()->map({i, v -> str2nr(v)}))
+ call assert_equal([65, 66, 67], 'ABC'->str2list())
+ call assert_equal(3, 'ABC'->strlen())
+ call assert_equal('a^Mb^[c', "a\rb\ec"->strtrans())
+ call assert_equal(4, "aあb"->strwidth())
+ call assert_equal('axc', 'abc'->substitute('b', 'x', ''))
+endfunc
+
func Test_append()
new
eval ['one', 'two', 'three']->append(1)