Improved table.vim tests. Fixed #24.

This commit is contained in:
Dhruva Sagar
2014-04-22 00:11:40 +05:30
parent 79166b3d4e
commit 7e00cea7f5
3 changed files with 58 additions and 28 deletions

View File

@@ -0,0 +1,7 @@
| Title | Message |
|--------+---------|
| test11 | test12 |
| test21 | test22 |
|--------+---------|

View File

@@ -5,38 +5,40 @@ call vspec#hint({'scope': 'tablemode#table#scope()', 'sid': 'tablemode#table#sid
describe 'table' describe 'table'
describe 'API' describe 'API'
before describe 'IsATableRow'
new before
read t/fixtures/sample.txt new
read t/fixtures/sample.txt
end
it 'should return true when inside a table'
Expect tablemode#table#IsATableRow(2) to_be_true
Expect tablemode#table#IsATableRow(3) to_be_true
end
it 'should return false when outside a table'
Expect tablemode#table#IsATableRow(1) to_be_false
Expect tablemode#table#IsATableRow(4) to_be_false
end
end end
it 'should return true when inside a table' describe 'IsATableHeader'
Expect tablemode#table#IsATableRow(2) to_be_true before
end new
read t/fixtures/sample_with_header.txt
end
it 'should return false when outside a table' it 'should return true when on a table header'
Expect tablemode#table#IsATableRow(4) to_be_false Expect tablemode#table#IsATableHeader(3) to_be_true
end Expect tablemode#table#IsATableHeader(6) to_be_true
end end
describe 'Tableize' it 'should return false when not on a table header'
before Expect tablemode#table#IsATableHeader(1) to_be_false
new Expect tablemode#table#IsATableHeader(2) to_be_false
read t/fixtures/tableize.txt Expect tablemode#table#IsATableHeader(4) to_be_false
end Expect tablemode#table#IsATableHeader(5) to_be_false
end
it 'should tableize with default delimiter'
:2,3call tablemode#TableizeRange('')
Expect tablemode#table#IsATableRow(2) to_be_true
Expect tablemode#spreadsheet#RowCount(2) == 2
Expect tablemode#spreadsheet#ColumnCount(2) == 3
end
it 'should tableize with given delimiter'
:2,3call tablemode#TableizeRange('/;')
Expect tablemode#table#IsATableRow(2) to_be_true
Expect tablemode#spreadsheet#RowCount(2) == 2
Expect tablemode#spreadsheet#ColumnCount(2) == 2
end end
end end
end end

View File

@@ -34,4 +34,25 @@ describe 'tablemode'
end end
end end
end end
describe 'Tableize'
before
new
read t/fixtures/tableize.txt
end
it 'should tableize with default delimiter'
:2,3call tablemode#TableizeRange('')
Expect tablemode#table#IsATableRow(2) to_be_true
Expect tablemode#spreadsheet#RowCount(2) == 2
Expect tablemode#spreadsheet#ColumnCount(2) == 3
end
it 'should tableize with given delimiter'
:2,3call tablemode#TableizeRange('/;')
Expect tablemode#table#IsATableRow(2) to_be_true
Expect tablemode#spreadsheet#RowCount(2) == 2
Expect tablemode#spreadsheet#ColumnCount(2) == 2
end
end
end end