From 943496c53556937290a33fe4f04b10028cdffe41 Mon Sep 17 00:00:00 2001 From: Dhruva Sagar Date: Mon, 7 Apr 2014 19:09:02 +0530 Subject: [PATCH] Added fixtures --- t/align.vim | 8 ++------ t/fixtures/align/simple_after.txt | 2 ++ t/fixtures/align/simple_before.txt | 2 ++ t/fixtures/align/unicode_after.txt | 2 ++ t/fixtures/align/unicode_before.txt | 2 ++ t/fixtures/sample.txt | 4 ++++ t/fixtures/tableize.txt | 4 ++++ t/spreadsheet.vim | 5 +---- t/table.vim | 7 ++----- 9 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 t/fixtures/align/simple_after.txt create mode 100644 t/fixtures/align/simple_before.txt create mode 100644 t/fixtures/align/unicode_after.txt create mode 100644 t/fixtures/align/unicode_before.txt create mode 100644 t/fixtures/sample.txt create mode 100644 t/fixtures/tableize.txt diff --git a/t/align.vim b/t/align.vim index 7347d3b..92d909b 100644 --- a/t/align.vim +++ b/t/align.vim @@ -5,14 +5,10 @@ call vspec#hint({'scope': 'tablemode#align#scope()', 'sid': 'tablemode#align#sid describe 'Align' it 'should align table content correctly' - let lines = ['| This | is a | table |', '| This | is also | a table |'] - let result = ['| This | is a | table |', '| This | is also | a table |'] - Expect tablemode#align#Align(lines) == result + Expect tablemode#align#Align(readfile('t/fixtures/align/simple_before.txt')) == readfile('t/fixtures/align/simple_after.txt') end it 'should align table content with unicode characters correctly' - let lines = ['| This | is 測試 | table |', '| This | is also | a table |'] - let result = ['| This | is 測試 | table |', '| This | is also | a table |'] - Expect tablemode#align#Align(lines) == result + Expect tablemode#align#Align(readfile('t/fixtures/align/unicode_before.txt')) == readfile('t/fixtures/align/unicode_after.txt') end end diff --git a/t/fixtures/align/simple_after.txt b/t/fixtures/align/simple_after.txt new file mode 100644 index 0000000..ed96f07 --- /dev/null +++ b/t/fixtures/align/simple_after.txt @@ -0,0 +1,2 @@ +| This | is a | table | +| This | is also | a table | diff --git a/t/fixtures/align/simple_before.txt b/t/fixtures/align/simple_before.txt new file mode 100644 index 0000000..b483ea5 --- /dev/null +++ b/t/fixtures/align/simple_before.txt @@ -0,0 +1,2 @@ +|This|is a|table| +|This|is also|a table| diff --git a/t/fixtures/align/unicode_after.txt b/t/fixtures/align/unicode_after.txt new file mode 100644 index 0000000..8778914 --- /dev/null +++ b/t/fixtures/align/unicode_after.txt @@ -0,0 +1,2 @@ +| This | is 測試 | table | +| This | is also | a table | diff --git a/t/fixtures/align/unicode_before.txt b/t/fixtures/align/unicode_before.txt new file mode 100644 index 0000000..3edd654 --- /dev/null +++ b/t/fixtures/align/unicode_before.txt @@ -0,0 +1,2 @@ +| This | is 測試 | table | +| This | is also | a table | diff --git a/t/fixtures/sample.txt b/t/fixtures/sample.txt new file mode 100644 index 0000000..e447226 --- /dev/null +++ b/t/fixtures/sample.txt @@ -0,0 +1,4 @@ + +| test11 | test12 | +| test21 | test22 | + diff --git a/t/fixtures/tableize.txt b/t/fixtures/tableize.txt new file mode 100644 index 0000000..ee1cc7a --- /dev/null +++ b/t/fixtures/tableize.txt @@ -0,0 +1,4 @@ + +asd,asd;asd,asd +asd,asd;asd,asd + diff --git a/t/spreadsheet.vim b/t/spreadsheet.vim index 2e12385..247cd18 100644 --- a/t/spreadsheet.vim +++ b/t/spreadsheet.vim @@ -7,9 +7,7 @@ describe 'spreadsheet' describe 'API' before new - normal! ggdG - call tablemode#TableModeEnable() - normal i |test11|test12| |test21|test22| + read t/fixtures/sample.txt end it 'should return the row count' @@ -79,7 +77,6 @@ describe 'spreadsheet' describe 'Manipulations' before new - normal! ggdG normal i|test11|test12| |test21|test22| call cursor(1, 3) end diff --git a/t/table.vim b/t/table.vim index 3c74384..8535747 100644 --- a/t/table.vim +++ b/t/table.vim @@ -7,9 +7,7 @@ describe 'table' describe 'API' before new - normal! ggdG - call tablemode#TableModeEnable() - normal i |test11|test12| |test21|test22| + read t/fixtures/sample.txt end it 'should return true when inside a table' @@ -24,8 +22,7 @@ describe 'table' describe 'Tableize' before new - normal! ggdG - normal i asd,asd;asd,asd asd,asd;asd,asd + read t/fixtures/tableize.txt end it 'should tableize with default delimiter'