Mercurial > vim
comparison src/testdir/test_source.vim @ 19145:ea3ac1de7704 v8.2.0132
patch 8.2.0132: script may be re-used when deleting and creating a new one
Commit: https://github.com/vim/vim/commit/ca33eb256eb910af05e8c9852bc9f716cece1f5c
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 19 20:18:09 2020 +0100
patch 8.2.0132: script may be re-used when deleting and creating a new one
Problem: Script may be re-used when deleting and creating a new one.
Solution: When the inode matches, also check the file name.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 19 Jan 2020 20:30:04 +0100 |
parents | 8d91579414b8 |
children | 9efea787c3a6 |
comparison
equal
deleted
inserted
replaced
19144:fc7387b02e42 | 19145:ea3ac1de7704 |
---|---|
44 call assert_equal('hello', getline(1)) | 44 call assert_equal('hello', getline(1)) |
45 call assert_fails('sandbox source! Xsourcehello', 'E48:') | 45 call assert_fails('sandbox source! Xsourcehello', 'E48:') |
46 bwipe! | 46 bwipe! |
47 call delete('Xsourcehello') | 47 call delete('Xsourcehello') |
48 endfunc | 48 endfunc |
49 | |
50 " When deleting a file and immediately creating a new one the inode may be | |
51 " recycled. Vim should not recognize it as the same script. | |
52 func Test_different_script() | |
53 call ch_logfile('logfile', 'w') | |
54 call writefile(['let s:var = "asdf"'], 'XoneScript') | |
55 source XoneScript | |
56 call delete('XoneScript') | |
57 call writefile(['let g:var = s:var'], 'XtwoScript') | |
58 call assert_fails('source XtwoScript', 'E121:') | |
59 call delete('XtwoScript') | |
60 endfunc |