Patch 7.4.1652
Problem: Old style test for fnamemodify().
Solution: Turn it into a new style test.
Files: src/testdir/test105.in, src/testdir/test105.ok,
src/testdir/test_fnamemodify.vim, src/testdir/test_alot.vim,
src/testdir/Make_all.mak
*** ../vim-7.4.1651/src/testdir/test105.in 2016-03-24 19:14:31.821092318
+0100
--- src/testdir/test105.in 1970-01-01 01:00:00.000000000 +0100
***************
*** 1,47 ****
- Test filename modifiers vim: set ft=vim :
-
- STARTTEST
- :source small.vim
- :%delete _
- :set shell=sh
- :set shellslash
- :let tab="\t"
- :command -nargs=1 Put :let expr=<q-args> | $put
=expr.tab.strtrans(string(eval(expr)))
- :let $HOME=fnamemodify('.', ':p:h:h')
- :Put fnamemodify('.', ':p' )[-1:]
- :Put fnamemodify('.', ':p:h' )[-1:]
- :Put fnamemodify('test.out', ':p' )[-1:]
- :Put fnamemodify('test.out', ':.' )
- :Put fnamemodify('../testdir/a', ':.' )
- :Put fnamemodify('test.out', ':~' )
- :Put fnamemodify('../testdir/a', ':~' )
- :Put fnamemodify('../testdir/a', ':t' )
- :Put fnamemodify('.', ':p:t' )
- :Put fnamemodify('test.out', ':p:t' )
- :Put fnamemodify('test.out', ':p:e' )
- :Put fnamemodify('test.out', ':p:t:e' )
- :Put fnamemodify('abc.fb2.tar.gz', ':r' )
- :Put fnamemodify('abc.fb2.tar.gz', ':r:r' )
- :Put fnamemodify('abc.fb2.tar.gz', ':r:r:r' )
- :Put substitute(fnamemodify('abc.fb2.tar.gz', ':p:r:r'), '.*\(testdir/.*\)',
'\1', '')
- :Put fnamemodify('abc.fb2.tar.gz', ':e' )
- :Put fnamemodify('abc.fb2.tar.gz', ':e:e' )
- :Put fnamemodify('abc.fb2.tar.gz', ':e:e:e' )
- :Put fnamemodify('abc.fb2.tar.gz', ':e:e:e:e')
- :Put fnamemodify('abc.fb2.tar.gz', ':e:e:r' )
- :Put fnamemodify('abc def', ':S' )
- :Put fnamemodify('abc" "def', ':S' )
- :Put fnamemodify('abc"%"def', ':S' )
- :Put fnamemodify('abc'' ''def', ':S' )
- :Put fnamemodify('abc''%''def', ':S' )
- :Put fnamemodify("abc\ndef", ':S' )
- :Put expand('%:r:S') == shellescape(expand('%:r'))
- :Put join([expand('%:r'), expand('%:r:S'), expand('%')], ',')
- :set shell=tcsh
- :Put fnamemodify("abc\ndef", ':S' )
- :$put ='vim: ts=8'
- :1 delete _
- :w! test.out
- :qa!
- ENDTEST
-
--- 0 ----
*** ../vim-7.4.1651/src/testdir/test105.ok 2016-03-24 19:14:31.821092318
+0100
--- src/testdir/test105.ok 1970-01-01 01:00:00.000000000 +0100
***************
*** 1,31 ****
- fnamemodify('.', ':p' )[-1:] '/'
- fnamemodify('.', ':p:h' )[-1:] 'r'
- fnamemodify('test.out', ':p' )[-1:] 't'
- fnamemodify('test.out', ':.' ) 'test.out'
- fnamemodify('../testdir/a', ':.' ) 'a'
- fnamemodify('test.out', ':~' ) '~/testdir/test.out'
- fnamemodify('../testdir/a', ':~' ) '~/testdir/a'
- fnamemodify('../testdir/a', ':t' ) 'a'
- fnamemodify('.', ':p:t' ) ''
- fnamemodify('test.out', ':p:t' ) 'test.out'
- fnamemodify('test.out', ':p:e' ) 'out'
- fnamemodify('test.out', ':p:t:e' ) 'out'
- fnamemodify('abc.fb2.tar.gz', ':r' ) 'abc.fb2.tar'
- fnamemodify('abc.fb2.tar.gz', ':r:r' ) 'abc.fb2'
- fnamemodify('abc.fb2.tar.gz', ':r:r:r' ) 'abc'
- substitute(fnamemodify('abc.fb2.tar.gz', ':p:r:r'), '.*\(testdir/.*\)', '\1',
'') 'testdir/abc.fb2'
- fnamemodify('abc.fb2.tar.gz', ':e' ) 'gz'
- fnamemodify('abc.fb2.tar.gz', ':e:e' ) 'tar.gz'
- fnamemodify('abc.fb2.tar.gz', ':e:e:e' ) 'fb2.tar.gz'
- fnamemodify('abc.fb2.tar.gz', ':e:e:e:e') 'fb2.tar.gz'
- fnamemodify('abc.fb2.tar.gz', ':e:e:r' ) 'tar'
- fnamemodify('abc def', ':S' ) '''abc def'''
- fnamemodify('abc" "def', ':S' ) '''abc" "def'''
- fnamemodify('abc"%"def', ':S' ) '''abc"%"def'''
- fnamemodify('abc'' ''def', ':S' ) '''abc''\'''' ''\''''def'''
- fnamemodify('abc''%''def', ':S' ) '''abc''\''''%''\''''def'''
- fnamemodify("abc\ndef", ':S' ) '''abc^@def'''
- expand('%:r:S') == shellescape(expand('%:r')) 1
- join([expand('%:r'), expand('%:r:S'), expand('%')], ',')
'test105,''test105'',test105.in'
- fnamemodify("abc\ndef", ':S' ) '''abc\^@def'''
- vim: ts=8
--- 0 ----
*** ../vim-7.4.1651/src/testdir/test_fnamemodify.vim 2016-03-25
17:53:59.578979646 +0100
--- src/testdir/test_fnamemodify.vim 2016-03-25 17:53:00.523579607 +0100
***************
*** 0 ****
--- 1,43 ----
+ " Test filename modifiers.
+
+ func Test_fnamemodify()
+ let $HOME = fnamemodify('.', ':p:h:h')
+ set shell=sh
+
+ call assert_equal('/', fnamemodify('.', ':p')[-1:])
+ call assert_equal('r', fnamemodify('.', ':p:h')[-1:])
+ call assert_equal('t', fnamemodify('test.out', ':p')[-1:])
+ call assert_equal('test.out', fnamemodify('test.out', ':.'))
+ call assert_equal('a', fnamemodify('../testdir/a', ':.'))
+ call assert_equal('~/testdir/test.out', fnamemodify('test.out', ':~'))
+ call assert_equal('~/testdir/a', fnamemodify('../testdir/a', ':~'))
+ call assert_equal('a', fnamemodify('../testdir/a', ':t'))
+ call assert_equal('', fnamemodify('.', ':p:t'))
+ call assert_equal('test.out', fnamemodify('test.out', ':p:t'))
+ call assert_equal('out', fnamemodify('test.out', ':p:e'))
+ call assert_equal('out', fnamemodify('test.out', ':p:t:e'))
+ call assert_equal('abc.fb2.tar', fnamemodify('abc.fb2.tar.gz', ':r'))
+ call assert_equal('abc.fb2', fnamemodify('abc.fb2.tar.gz', ':r:r'))
+ call assert_equal('abc', fnamemodify('abc.fb2.tar.gz', ':r:r:r'))
+ call assert_equal('testdir/abc.fb2',
substitute(fnamemodify('abc.fb2.tar.gz', ':p:r:r'), '.*\(testdir/.*\)', '\1',
''))
+ call assert_equal('gz', fnamemodify('abc.fb2.tar.gz', ':e'))
+ call assert_equal('tar.gz', fnamemodify('abc.fb2.tar.gz', ':e:e'))
+ call assert_equal('fb2.tar.gz', fnamemodify('abc.fb2.tar.gz', ':e:e:e'))
+ call assert_equal('fb2.tar.gz', fnamemodify('abc.fb2.tar.gz', ':e:e:e:e'))
+ call assert_equal('tar', fnamemodify('abc.fb2.tar.gz', ':e:e:r'))
+
+ call assert_equal('''abc def''', fnamemodify('abc def', ':S'))
+ call assert_equal('''abc" "def''', fnamemodify('abc" "def', ':S'))
+ call assert_equal('''abc"%"def''', fnamemodify('abc"%"def', ':S'))
+ call assert_equal('''abc''\'''' ''\''''def''', fnamemodify('abc'' ''def',
':S'))
+ call assert_equal('''abc''\''''%''\''''def''', fnamemodify('abc''%''def',
':S'))
+ call assert_equal(expand('%:r:S'), shellescape(expand('%:r')))
+ sp test_alot.vim
+ call assert_equal('test_alot,''test_alot'',test_alot.vim',
join([expand('%:r'), expand('%:r:S'), expand('%')], ','))
+ quit
+
+ call assert_equal("'abc\ndef'", fnamemodify("abc\ndef", ':S'))
+ set shell=tcsh
+ call assert_equal("'abc\\\ndef'", fnamemodify("abc\ndef", ':S'))
+ set shell&
+ endfunc
*** ../vim-7.4.1651/src/testdir/test_alot.vim 2016-03-19 19:37:56.069824594
+0100
--- src/testdir/test_alot.vim 2016-03-25 17:30:02.217586689 +0100
***************
*** 8,13 ****
--- 8,14 ----
source test_expr.vim
source test_expand.vim
source test_feedkeys.vim
+ source test_fnamemodify.vim
source test_file_perm.vim
source test_glob2regpat.vim
source test_help_tagjump.vim
*** ../vim-7.4.1651/src/testdir/Make_all.mak 2016-03-19 22:53:54.229469402
+0100
--- src/testdir/Make_all.mak 2016-03-25 17:54:26.442706726 +0100
***************
*** 85,91 ****
test102.out \
test103.out \
test104.out \
- test105.out \
test107.out \
test108.out \
test_autocmd_option.out \
--- 85,90 ----
*** ../vim-7.4.1651/src/version.c 2016-03-25 17:21:15.870934592 +0100
--- src/version.c 2016-03-25 17:49:37.449642618 +0100
***************
*** 750,751 ****
--- 750,753 ----
{ /* Add new patch number below this line */
+ /**/
+ 1652,
/**/
--
hundred-and-one symptoms of being an internet addict:
121. You ask for e-mail adresses instead of telephone numbers.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.