Mercurial > vim
comparison src/testdir/test_functions.vim @ 29875:cb4d95b545f1 v9.0.0276
patch 9.0.0276: 'buftype' values not sufficiently tested
Commit: https://github.com/vim/vim/commit/93f72cc119c796f1ccb75468ef9e446cbfb41e9b
Author: zeertzjq <zeertzjq@outlook.com>
Date: Fri Aug 26 15:34:52 2022 +0100
patch 9.0.0276: 'buftype' values not sufficiently tested
Problem: 'buftype' values not sufficiently tested.
Solution: Add and extend tests with 'buftype' values. (closes https://github.com/vim/vim/issues/10988)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 26 Aug 2022 16:45:03 +0200 |
parents | a4eab0d846dc |
children | d891115c0aea |
comparison
equal
deleted
inserted
replaced
29874:fd1e8bf02d4b | 29875:cb4d95b545f1 |
---|---|
2366 call assert_equal(0, bufexists(buf1)) | 2366 call assert_equal(0, bufexists(buf1)) |
2367 call assert_equal(1, bufexists(buf2)) | 2367 call assert_equal(1, bufexists(buf2)) |
2368 exe 'bwipe ' .. buf2 | 2368 exe 'bwipe ' .. buf2 |
2369 call assert_equal(0, bufexists(buf2)) | 2369 call assert_equal(0, bufexists(buf2)) |
2370 | 2370 |
2371 " when 'buftype' is "nofile" then bufload() does not read the file | 2371 " When 'buftype' is "nofile" then bufload() does not read the file. |
2372 bwipe! XotherName | 2372 " Other values too. |
2373 let buf = bufadd('XotherName') | 2373 for val in [['nofile', 0], |
2374 call setbufvar(buf, '&bt', 'nofile') | 2374 \ ['nowrite', 1], |
2375 call bufload(buf) | 2375 \ ['acwrite', 1], |
2376 call assert_equal([''], getbufline(buf, 1, '$')) | 2376 \ ['quickfix', 0], |
2377 | 2377 \ ['help', 1], |
2378 " when 'buftype' is "acwrite" then bufload() DOES read the file | 2378 \ ['terminal', 0], |
2379 bwipe! XotherName | 2379 \ ['prompt', 0], |
2380 let buf = bufadd('XotherName') | 2380 \ ['popup', 0], |
2381 call setbufvar(buf, '&bt', 'acwrite') | 2381 \ ] |
2382 call bufload(buf) | 2382 bwipe! XotherName |
2383 call assert_equal(['some', 'text'], getbufline(buf, 1, '$')) | 2383 let buf = bufadd('XotherName') |
2384 call setbufvar(buf, '&bt', val[0]) | |
2385 call bufload(buf) | |
2386 call assert_equal(val[1] ? ['some', 'text'] : [''], getbufline(buf, 1, '$'), val[0]) | |
2387 endfor | |
2384 | 2388 |
2385 bwipe someName | 2389 bwipe someName |
2386 bwipe XotherName | 2390 bwipe XotherName |
2387 call assert_equal(0, bufexists('someName')) | 2391 call assert_equal(0, bufexists('someName')) |
2388 call delete('XotherName') | 2392 call delete('XotherName') |