Permalink
Browse files

moved spec/tlib/* to tlib_vim

  • Loading branch information...
1 parent 268d7e9 commit fca7ddf466473063472f7a61ba28f4b560bc6bd7 @tomtom committed Apr 4, 2013
Showing with 0 additions and 475 deletions.
  1. +0 −66 spec/tlib/arg.vim
  2. +0 −40 spec/tlib/date.vim
  3. +0 −59 spec/tlib/file.vim
  4. +0 −127 spec/tlib/input.vim
  5. +0 −67 spec/tlib/list.vim
  6. +0 −27 spec/tlib/rx.vim
  7. +0 −29 spec/tlib/string.vim
  8. +0 −23 spec/tlib/url.vim
  9. +0 −37 spec/tlib/var.vim
View
66 spec/tlib/arg.vim
@@ -1,66 +0,0 @@
-" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
-" @Website: http://www.vim.org/account/profile.php?user_id=4037
-" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
-" @Created: 2010-04-03.
-" @Last Change: 2010-04-03.
-" @Revision: 1
-
-let s:save_cpo = &cpo
-set cpo&vim
-
-
-
-SpecBegin 'title': 'tlib#arg'
-
-function! TestGetArg(...) "{{{3
- exec tlib#arg#Get(1, 'foo', 1)
- return foo
-endf
-
-function! TestGetArg1(...) "{{{3
- exec tlib#arg#Get(1, 'foo', 1, '!= ""')
- return foo
-endf
-
-Should be equal TestGetArg(), 1
-Should be equal TestGetArg(''), ''
-Should be equal TestGetArg(2), 2
-Should be equal TestGetArg1(), 1
-Should be equal TestGetArg1(''), 1
-Should be equal TestGetArg1(2), 2
-
-function! TestArgs(...) "{{{3
- exec tlib#arg#Let([['foo', "o"], ['bar', 2]])
- return repeat(foo, bar)
-endf
-Should be equal TestArgs(), 'oo'
-Should be equal TestArgs('a'), 'aa'
-Should be equal TestArgs('a', 3), 'aaa'
-
-function! TestArgs1(...) "{{{3
- exec tlib#arg#Let(['foo', ['bar', 2]])
- return repeat(foo, bar)
-endf
-Should be equal TestArgs1(), ''
-Should be equal TestArgs1('a'), 'aa'
-Should be equal TestArgs1('a', 3), 'aaa'
-
-function! TestArgs2(...) "{{{3
- exec tlib#arg#Let(['foo', 'bar'], 1)
- return repeat(foo, bar)
-endf
-Should be equal TestArgs2(), '1'
-Should be equal TestArgs2('a'), 'a'
-Should be equal TestArgs2('a', 3), 'aaa'
-
-function! TestArgs3(...)
- TVarArg ['a', 1], 'b'
- return a . b
-endf
-Should be equal TestArgs3(), '1'
-Should be equal TestArgs3('a'), 'a'
-Should be equal TestArgs3('a', 3), 'a3'
-
-
-let &cpo = s:save_cpo
-unlet s:save_cpo
View
40 spec/tlib/date.vim
@@ -1,40 +0,0 @@
-" @Author: Tom Link (micathom AT gmail com?subject=[vim])
-" @Website: http://www.vim.org/account/profile.php?user_id=4037
-" @GIT: http://github.com/tomtom/vimtlib/
-" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
-" @Created: 2010-09-17.
-" @Last Change: 2010-09-17.
-" @Revision: 16
-
-SpecBegin 'title': 'tlib#date'
-
-Should be equal tlib#date#Parse('2000-1-0', 1), [2000, 1, 0]
-Should be equal tlib#date#Parse('2000-1-2'), [2000, 1, 2]
-Should be equal tlib#date#Parse('2000-01-02'), [2000, 1, 2]
-Should be equal tlib#date#Parse('2000-10-20'), [2000, 10, 20]
-
-Should be equal tlib#date#Parse('00-1-0', 1), [2000, 1, 0]
-Should be equal tlib#date#Parse('00-1-2'), [2000, 1, 2]
-Should be equal tlib#date#Parse('00-01-02'), [2000, 1, 2]
-Should be equal tlib#date#Parse('00-10-20'), [2000, 10, 20]
-
-Should be equal tlib#date#Parse('2000/2/1'), [2000, 1, 2]
-Should be equal tlib#date#Parse('2000/02/01'), [2000, 1, 2]
-Should be equal tlib#date#Parse('2000/20/10'), [2000, 10, 20]
-
-Should be equal tlib#date#Parse('00/2/1'), [2000, 1, 2]
-Should be equal tlib#date#Parse('00/02/01'), [2000, 1, 2]
-Should be equal tlib#date#Parse('00/20/10'), [2000, 10, 20]
-
-Should be equal tlib#date#Parse('2.1.2000'), [2000, 1, 2]
-Should be equal tlib#date#Parse('2. 1. 2000'), [2000, 1, 2]
-Should be equal tlib#date#Parse('02.01.2000'), [2000, 1, 2]
-Should be equal tlib#date#Parse('02. 01. 2000'), [2000, 1, 2]
-Should be equal tlib#date#Parse('20.10.2000'), [2000, 10, 20]
-Should be equal tlib#date#Parse('20. 10. 2000'), [2000, 10, 20]
-
-Should throw exception "tlib#date#Parse('2000-14-2')", 'TLib: Invalid date'
-Should throw exception "tlib#date#Parse('2000-011-02')", 'TLib: Invalid date'
-Should throw exception "tlib#date#Parse('2000-10-40')", 'TLib: Invalid date'
-Should throw exception "tlib#date#Parse('2000-10-0')", 'TLib: Invalid date'
-
View
59 spec/tlib/file.vim
@@ -1,59 +0,0 @@
-" @Author: Thomas Link (micathom AT gmail com?subject=[vim])
-" @Website: http://www.vim.org/account/profile.php?user_id=4037
-" @GIT: http://github.com/tomtom/vimtlib/
-" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
-" @Created: 2009-02-25.
-" @Last Change: 2010-04-03.
-" @Revision: 13
-
-let s:save_cpo = &cpo
-set cpo&vim
-
-
-SpecBegin 'title': 'tlib/file',
- \ 'sfile': 'autoload/tlib/file.vim'
-
-
-
-It should split filenames.
-Should be equal tlib#file#Split('foo/bar/filename.txt'), ['foo', 'bar', 'filename.txt']
-Should be equal tlib#file#Split('/foo/bar/filename.txt'), ['', 'foo', 'bar', 'filename.txt']
-Should be equal tlib#file#Split('ftp://foo/bar/filename.txt'), ['ftp:/', 'foo', 'bar', 'filename.txt']
-
-
-It should join filenames.
-Should be#Equal tlib#file#Join(['foo', 'bar']), 'foo/bar'
-Should be#Equal tlib#file#Join(['foo/', 'bar'], 1), 'foo/bar'
-Should be#Equal tlib#file#Join(['', 'bar']), '/bar'
-Should be#Equal tlib#file#Join(['/', 'bar'], 1), '/bar'
-Should be#Equal tlib#file#Join(['foo', 'bar', 'filename.txt']), 'foo/bar/filename.txt'
-Should be#Equal tlib#file#Join(['', 'foo', 'bar', 'filename.txt']), '/foo/bar/filename.txt'
-Should be#Equal tlib#file#Join(['ftp:/', 'foo', 'bar', 'filename.txt']), 'ftp://foo/bar/filename.txt'
-Should be#Equal tlib#file#Join(['ftp://', 'foo', 'bar', 'filename.txt'], 1), 'ftp://foo/bar/filename.txt'
-
-Should be equal tlib#file#Join(['foo', 'bar', 'filename.txt']), 'foo/bar/filename.txt'
-Should be equal tlib#file#Join(['', 'foo', 'bar', 'filename.txt']), '/foo/bar/filename.txt'
-Should be equal tlib#file#Join(['ftp:/', 'foo', 'bar', 'filename.txt']), 'ftp://foo/bar/filename.txt'
-
-
-It should construct relative path names.
-Should be#Equal tlib#file#Relative('foo/bar/filename.txt', 'foo'), 'bar/filename.txt'
-Should be#Equal tlib#file#Relative('foo/bar/filename.txt', 'foo/base'), '../bar/filename.txt'
-Should be#Equal tlib#file#Relative('filename.txt', 'foo/base'), '../../filename.txt'
-Should be#Equal tlib#file#Relative('/foo/bar/filename.txt', '/boo/base'), '../../foo/bar/filename.txt'
-Should be#Equal tlib#file#Relative('/bar/filename.txt', '/boo/base'), '../../bar/filename.txt'
-Should be#Equal tlib#file#Relative('/foo/bar/filename.txt', '/base'), '../foo/bar/filename.txt'
-Should be#Equal tlib#file#Relative('c:/bar/filename.txt', 'x:/boo/base'), 'c:/bar/filename.txt'
-
-
-Should be equal tlib#file#Relative('foo/bar/filename.txt', 'foo'), 'bar/filename.txt'
-Should be equal tlib#file#Relative('foo/bar/filename.txt', 'foo/base'), '../bar/filename.txt'
-Should be equal tlib#file#Relative('filename.txt', 'foo/base'), '../../filename.txt'
-Should be equal tlib#file#Relative('/foo/bar/filename.txt', '/boo/base'), '../../foo/bar/filename.txt'
-Should be equal tlib#file#Relative('/bar/filename.txt', '/boo/base'), '../../bar/filename.txt'
-Should be equal tlib#file#Relative('/foo/bar/filename.txt', '/base'), '../foo/bar/filename.txt'
-Should be equal tlib#file#Relative('c:/bar/filename.txt', 'x:/boo/base'), 'c:/bar/filename.txt'
-
-
-let &cpo = s:save_cpo
-unlet s:save_cpo
View
127 spec/tlib/input.vim
@@ -1,127 +0,0 @@
-" @Author: Tom Link (micathom AT gmail com?subject=[vim])
-" @Website: http://www.vim.org/account/profile.php?user_id=4037
-" @GIT: http://github.com/tomtom/vimtlib/
-" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
-" @Created: 2009-02-28.
-" @Last Change: 2009-03-14.
-" @Revision: 73
-
-let s:save_cpo = &cpo
-set cpo&vim
-
-
-SpecBegin 'title': 'tlib: Input', 'scratch': '%',
- \ 'after': ':unlet! g:spec_lib_rv',
- \ 'options': [
- \ 'vim',
- \ ]
-
-
-let g:spec_tlib_list = [10, 20, 30, 40, 'a50', 'aa60', 'b70', 'ba80', 90]
-
-
-
-It should return empty values when the user presses <escape>.
-Replay :let g:spec_lib_rv = tlib#input#List('s', '', g:spec_tlib_list)\<cr>
- \ \<Down>\<Down>\<esc>
-Should be#Equal g:spec_lib_rv, ''
-
-Replay :let g:spec_lib_rv = tlib#input#List('m', '', g:spec_tlib_list)\<cr>
- \ \<Down>\<Down>\<esc>
-Should be#Equal g:spec_lib_rv, []
-
-Replay :let g:spec_lib_rv = tlib#input#List('si', '', g:spec_tlib_list)\<cr>
- \ \<Down>\<Down>\<esc>
-Should be#Equal g:spec_lib_rv, 0
-
-
-
-It should pick an item from s-type list.
-Replay :let g:spec_lib_rv = tlib#input#List('s', '', g:spec_tlib_list)\<cr>
- \ \<Down>\<Down>\<cr>
-Should be#Equal g:spec_lib_rv, 30
-
-
-
-It should return an index from si-type list.
-Replay :let g:spec_lib_rv = tlib#input#List('si', '', g:spec_tlib_list)\<cr>
- \ \<Down>\<Down>\<cr>
-Should be#Equal g:spec_lib_rv, 3
-
-
-
-It should return a list from a m-type list.
-Replay :let g:spec_lib_rv = tlib#input#List('m', '', g:spec_tlib_list)\<cr>
- \ \<Down>#\<Down>\<Down>\<cr>
-Should be#Equal sort(g:spec_lib_rv), [20, 40]
-
-Replay :let g:spec_lib_rv = tlib#input#List('m', '', g:spec_tlib_list)\<cr>
- \ \<Down>\<S-Down>\<cr>
-Should be#Equal sort(g:spec_lib_rv), [20, 30]
-
-Replay :let g:spec_lib_rv = tlib#input#List('m', '', g:spec_tlib_list)\<cr>
- \ \<Down>\<Down>\<S-up>\<cr>
-Should be#Equal sort(g:spec_lib_rv), [20, 30]
-
-
-
-It should return a list of indices from a mi-type list.
-Replay :let g:spec_lib_rv = tlib#input#List('mi', '', g:spec_tlib_list)\<cr>
- \ \<Down>#\<Down>\<Down>\<cr>
-Should be#Equal sort(g:spec_lib_rv), [2, 4]
-
-Replay :let g:spec_lib_rv = tlib#input#List('mi', '', g:spec_tlib_list)\<cr>
- \ \<Down>\<S-Down>\<cr>
-Should be#Equal sort(g:spec_lib_rv), [2, 3]
-
-Replay :let g:spec_lib_rv = tlib#input#List('mi', '', g:spec_tlib_list)\<cr>
- \ \<Down>\<Down>\<S-up>\<cr>
-Should be#Equal sort(g:spec_lib_rv), [2, 3]
-
-
-
-It should filter items from a s-type list.
-Replay :let g:spec_lib_rv = tlib#input#List('s', '', g:spec_tlib_list)\<cr>
- \ \<Down>a\<Down>\<cr>
-Should be#Equal g:spec_lib_rv, 'aa60'
-
-
-
-It should filter items from a si-type list.
-Replay :let g:spec_lib_rv = tlib#input#List('si', '', g:spec_tlib_list)\<cr>
- \ \<Down>a\<Down>\<cr>
-Should be#Equal g:spec_lib_rv, 6
-
-
-
-It should filter items from a m-type list.
-Replay :let g:spec_lib_rv = tlib#input#List('m', '', g:spec_tlib_list)\<cr>
- \ a\<Down>#\<Down>\<cr>
-Should be#Equal sort(g:spec_lib_rv), ['aa60', 'ba80']
-
-Replay :let g:spec_lib_rv = tlib#input#List('m', '', g:spec_tlib_list)\<cr>
- \ a\<Down>\<S-Down>\<cr>
-Should be#Equal sort(g:spec_lib_rv), ['aa60', 'ba80']
-
-Replay :let g:spec_lib_rv = tlib#input#List('m', '', g:spec_tlib_list)\<cr>
- \ a\<Down>\<Down>\<S-up>\<cr>
-Should be#Equal sort(g:spec_lib_rv), ['aa60', 'ba80']
-
-
-
-It should filter items from a mi-type list.
-Replay :let g:spec_lib_rv = tlib#input#List('mi', '', g:spec_tlib_list)\<cr>
- \ a\<Down>#\<Down>\<cr>
-Should be#Equal sort(g:spec_lib_rv), [6, 8]
-
-Replay :let g:spec_lib_rv = tlib#input#List('mi', '', g:spec_tlib_list)\<cr>
- \ a\<Down>\<S-Down>\<cr>
-Should be#Equal sort(g:spec_lib_rv), [6, 8]
-
-Replay :let g:spec_lib_rv = tlib#input#List('mi', '', g:spec_tlib_list)\<cr>
- \ a\<Down>\<Down>\<S-up>\<cr>
-Should be#Equal sort(g:spec_lib_rv), [6, 8]
-
-
-
-let &cpo = s:save_cpo
View
67 spec/tlib/list.vim
@@ -1,67 +0,0 @@
-" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
-" @Website: http://www.vim.org/account/profile.php?user_id=4037
-" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
-" @Created: 2010-04-03.
-" @Last Change: 2010-04-03.
-" @Revision: 4
-
-let s:save_cpo = &cpo
-set cpo&vim
-
-
-
-SpecBegin 'title': 'tlib: List'
- " \, 'options': [vim, <+SET+>]
- " \, 'sfile': '<+SCRIPT CONTEXT+>'
- " \, 'scratch': '<+SCRATCH FILE+>'
- " \, 'before': '<+BEFORE EX COMMANDS+>'
- " \, 'after': '<+AFTER EX COMMANDS+>'
- " \, 'cleanup': ['<+FUNCTION+>()']
-
-
-" List {{{2
-fun! Add(a,b)
- return a:a + a:b
-endf
-
-Should be equal tlib#list#Inject([], 0, function('Add')), 0
-Should be equal tlib#list#Inject([1,2,3], 0, function('Add')), 6
-
-Should be equal tlib#list#Compact([]), []
-Should be equal tlib#list#Compact([0,1,2,3,[], {}, ""]), [1,2,3]
-
-Should be equal tlib#list#Flatten([]), []
-Should be equal tlib#list#Flatten([1,2,3]), [1,2,3]
-Should be equal tlib#list#Flatten([1,2, [1,2,3], 3]), [1,2,1,2,3,3]
-Should be equal tlib#list#Flatten([0,[1,2,[3,""]]]), [0,1,2,3,""]
-
-Should be equal tlib#list#FindAll([1,2,3], 'v:val >= 2'), [2,3]
-Should be equal tlib#list#FindAll([1,2,3], 'v:val >= 2', 'v:val * 10'), [20,30]
-
-Should be equal tlib#list#Find([1,2,3], 'v:val >= 2'), 2
-Should be equal tlib#list#Find([1,2,3], 'v:val >= 2', 0, 'v:val * 10'), 20
-Should be equal tlib#list#Find([1,2,3], 'v:val >= 5', 10), 10
-
-Should be equal tlib#list#Any([1,2,3], 'v:val >= 2'), 1
-Should be equal tlib#list#Any([1,2,3], 'v:val >= 5'), 0
-
-Should be equal tlib#list#All([1,2,3], 'v:val < 5'), 1
-Should be equal tlib#list#All([1,2,3], 'v:val >= 2'), 0
-
-Should be equal tlib#list#Remove([1,2,1,2], 2), [1,1,2]
-Should be equal tlib#list#RemoveAll([1,2,1,2], 2), [1,1]
-
-Should be equal tlib#list#Zip([[1,2,3], [4,5,6]]), [[1,4], [2,5], [3,6]]
-Should be equal tlib#list#Zip([[1,2,3], [4,5,6,7]]), [[1,4], [2,5], [3,6], ['', 7]]
-Should be equal tlib#list#Zip([[1,2,3], [4,5,6,7]], -1), [[1,4], [2,5], [3,6], [-1,7]]
-Should be equal tlib#list#Zip([[1,2,3,7], [4,5,6]], -1), [[1,4], [2,5], [3,6], [7,-1]]
-
-
-Should be equal tlib#list#Uniq([]), []
-Should be equal tlib#list#Uniq([1,1]), [1]
-Should be equal tlib#list#Uniq([1,2,2,3,2,3,4,2,1,7,2,3,2,3,7]), [1,2,3,4,7]
-
-
-
-let &cpo = s:save_cpo
-unlet s:save_cpo
View
27 spec/tlib/rx.vim
@@ -1,27 +0,0 @@
-" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
-" @Website: http://www.vim.org/account/profile.php?user_id=4037
-" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
-" @Created: 2010-04-03.
-" @Last Change: 2010-04-03.
-" @Revision: 2
-
-let s:save_cpo = &cpo
-set cpo&vim
-
-
-
-SpecBegin 'title': 'tlib#rx'
-
-
-for c in split('^$.*+\()|{}[]~', '\zs')
- let s = printf('%sfoo%sbar%s', c, c, c)
- Should be like s, '\m^'. tlib#rx#Escape(s, 'm') .'$'
- Should be like s, '\M^'. tlib#rx#Escape(s, 'M') .'$'
- Should be like s, '\v^'. tlib#rx#Escape(s, 'v') .'$'
- Should be like s, '\V\^'. tlib#rx#Escape(s, 'V') .'\$'
-endfor
-
-
-
-let &cpo = s:save_cpo
-unlet s:save_cpo
View
29 spec/tlib/string.vim
@@ -1,29 +0,0 @@
-" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
-" @Website: http://www.vim.org/account/profile.php?user_id=4037
-" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
-" @Created: 2010-04-03.
-" @Last Change: 2010-04-03.
-" @Revision: 4
-
-let s:save_cpo = &cpo
-set cpo&vim
-
-
-
-SpecBegin 'title': 'tlib#string'
-
-Should be equal tlib#string#RemoveBackslashes('foo bar'), 'foo bar'
-Should be equal tlib#string#RemoveBackslashes('foo\ bar'), 'foo bar'
-Should be equal tlib#string#RemoveBackslashes('foo\ \\bar'), 'foo \\bar'
-Should be equal tlib#string#RemoveBackslashes('foo\ \\bar', '\ '), 'foo \bar'
-
-
-Should be equal tlib#string#Count("fooo", "o"), 3
-Should be equal tlib#string#Count("***", "\\*"), 3
-Should be equal tlib#string#Count("***foo", "\\*"), 3
-Should be equal tlib#string#Count("foo***", "\\*"), 3
-
-
-
-let &cpo = s:save_cpo
-unlet s:save_cpo
View
23 spec/tlib/url.vim
@@ -1,23 +0,0 @@
-" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
-" @Website: http://www.vim.org/account/profile.php?user_id=4037
-" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
-" @Created: 2010-04-03.
-" @Last Change: 2010-04-03.
-" @Revision: 2
-
-let s:save_cpo = &cpo
-set cpo&vim
-
-
-
-SpecBegin 'title': 'tlib#url'
-
-Should be equal tlib#url#Decode('http://example.com/foo+bar%25bar'), 'http://example.com/foo bar%bar'
-Should be equal tlib#url#Decode('Hello%20World.%20%20Good%2c%20bye.'), 'Hello World. Good, bye.'
-
-Should be equal tlib#url#Encode('foo bar%bar'), 'foo+bar%%bar'
-Should be equal tlib#url#Encode('Hello World. Good, bye.'), 'Hello+World.+Good%2c+bye.'
-
-
-let &cpo = s:save_cpo
-unlet s:save_cpo
View
37 spec/tlib/var.vim
@@ -1,37 +0,0 @@
-" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
-" @Website: http://www.vim.org/account/profile.php?user_id=4037
-" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
-" @Created: 2010-04-03.
-" @Last Change: 2010-04-03.
-" @Revision: 2
-
-let s:save_cpo = &cpo
-set cpo&vim
-
-
-
-SpecBegin 'title': 'tlib#var'
-
-
-let g:foo = 1
-let g:bar = 2
-let b:bar = 3
-let s:bar = 4
-
-Should be equal tlib#var#Get('bar', 'bg'), 3
-Should be equal tlib#var#Get('bar', 'g'), 2
-Should be equal tlib#var#Get('foo', 'bg'), 1
-Should be equal tlib#var#Get('foo', 'g'), 1
-Should be equal tlib#var#Get('none', 'l'), ''
-
-Should be equal eval(tlib#var#EGet('bar', 'bg')), 3
-Should be equal eval(tlib#var#EGet('bar', 'g')), 2
-" Should be equal eval(tlib#var#EGet('bar', 'sg')), 4
-Should be equal eval(tlib#var#EGet('foo', 'bg')), 1
-Should be equal eval(tlib#var#EGet('foo', 'g')), 1
-Should be equal eval(tlib#var#EGet('none', 'l')), ''
-
-
-
-let &cpo = s:save_cpo
-unlet s:save_cpo

0 comments on commit fca7ddf

Please sign in to comment.