Mercurial > vim
comparison src/testdir/test_blob.vim @ 28289:cdaff4db7760 v8.2.4670
patch 8.2.4670: memory allocation failures for new tab page not tested
Commit: https://github.com/vim/vim/commit/72bb47e38f6805050ed6d969f17591bed71f83d4
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sun Apr 3 11:22:38 2022 +0100
patch 8.2.4670: memory allocation failures for new tab page not tested
Problem: Memory allocation failures for new tab page not tested.
Solution: Add tests with failing memory allocation. (Yegappan Lakshmanan,
closes #10067)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 03 Apr 2022 12:30:03 +0200 |
parents | 4c16acb2525f |
children | 35e24d9de858 |
comparison
equal
deleted
inserted
replaced
28288:a044daf370c5 | 28289:cdaff4db7760 |
---|---|
700 let v ..= '01' | 700 let v ..= '01' |
701 exe 'let b = ' .. v | 701 exe 'let b = ' .. v |
702 call assert_equal(v, string(b)) | 702 call assert_equal(v, string(b)) |
703 endfunc | 703 endfunc |
704 | 704 |
705 " Test for blob allocation failure | |
706 func Test_blob_alloc_failure() | |
707 " blob variable | |
708 call test_alloc_fail(GetAllocId('blob_alloc'), 0, 0) | |
709 call assert_fails('let v = 0z10', 'E342:') | |
710 | |
711 " blob slice | |
712 let v = 0z1020 | |
713 call test_alloc_fail(GetAllocId('blob_alloc'), 0, 0) | |
714 call assert_fails('let x = v[0:0]', 'E342:') | |
715 call assert_equal(0z1020, x) | |
716 | |
717 " blob remove() | |
718 let v = 0z10203040 | |
719 call test_alloc_fail(GetAllocId('blob_alloc'), 0, 0) | |
720 call assert_fails('let x = remove(v, 1, 2)', 'E342:') | |
721 call assert_equal(0, x) | |
722 | |
723 " list2blob() | |
724 call test_alloc_fail(GetAllocId('blob_alloc'), 0, 0) | |
725 call assert_fails('let a = list2blob([1, 2, 4])', 'E342:') | |
726 call assert_equal(0, a) | |
727 | |
728 " mapnew() | |
729 call test_alloc_fail(GetAllocId('blob_alloc'), 0, 0) | |
730 call assert_fails('let x = mapnew(0z1234, {_, v -> 1})', 'E342:') | |
731 call assert_equal(0, x) | |
732 | |
733 " copy() | |
734 call test_alloc_fail(GetAllocId('blob_alloc'), 0, 0) | |
735 call assert_fails('let x = copy(v)', 'E342:') | |
736 call assert_equal(0z, x) | |
737 | |
738 " readblob() | |
739 call test_alloc_fail(GetAllocId('blob_alloc'), 0, 0) | |
740 call assert_fails('let x = readblob("test_blob.vim")', 'E342:') | |
741 call assert_equal(0, x) | |
742 endfunc | |
743 | |
705 " vim: shiftwidth=2 sts=2 expandtab | 744 " vim: shiftwidth=2 sts=2 expandtab |