diff options
author | Thomas Wienecke <wienecke.t@gmail.com> | 2014-03-30 15:30:10 +0200 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-03 10:32:41 -0300 |
commit | 7021b970b9e8b3f9b9fe71546bfb3aa30851abd2 (patch) | |
tree | 6d7d79452963fec9b10dbaa24778175ea1829268 /test | |
parent | 77bfb6cd990c67e4191d4858af82de42303e1939 (diff) | |
download | rneovim-7021b970b9e8b3f9b9fe71546bfb3aa30851abd2.tar.gz rneovim-7021b970b9e8b3f9b9fe71546bfb3aa30851abd2.tar.bz2 rneovim-7021b970b9e8b3f9b9fe71546bfb3aa30851abd2.zip |
Test and refactor gettail_sep -> path_tail_with_seperator.
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/path.moon | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/unit/path.moon b/test/unit/path.moon index 9004cc241c..efa3a2ce74 100644 --- a/test/unit/path.moon +++ b/test/unit/path.moon @@ -8,6 +8,7 @@ typedef enum file_comparison { } FileComparison; FileComparison path_full_compare(char_u *s1, char_u *s2, int checkname); char_u *path_tail(char_u *fname); +char_u *path_tail_with_seperator(char_u *fname); ]] -- import constants parsed by ffi @@ -62,3 +63,25 @@ describe 'path function', -> it 'returns an empty string if file ends in a slash', -> eq '', path_tail 'directory/' + + describe 'path_tail_with_seperator', -> + path_tail_with_seperator = (file) -> + res = path.path_tail_with_seperator (to_cstr file) + neq NULL, res + ffi.string res + + it 'returns the tail of a file together with its seperator', -> + eq '///file.txt', path_tail_with_seperator 'directory///file.txt' + + it 'returns an empty string when given an empty file name', -> + eq '', path_tail_with_seperator '' + + it 'returns only the seperator if there is a traling seperator', -> + eq '/', path_tail_with_seperator 'some/directory/' + + it 'cuts a leading seperator', -> + eq 'file.txt', path_tail_with_seperator '/file.txt' + eq '', path_tail_with_seperator '/' + + it 'returns the whole file name if there is no seperator', -> + eq 'file.txt', path_tail_with_seperator 'file.txt' |