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,6 +5,7 @@ call vspec#hint({'scope': 'tablemode#table#scope()', 'sid': 'tablemode#table#sid
describe 'table'
describe 'API'
describe 'IsATableRow'
before
new
read t/fixtures/sample.txt
@@ -12,31 +13,32 @@ describe 'table'
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
describe 'Tableize'
describe 'IsATableHeader'
before
new
read t/fixtures/tableize.txt
read t/fixtures/sample_with_header.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
it 'should return true when on a table header'
Expect tablemode#table#IsATableHeader(3) to_be_true
Expect tablemode#table#IsATableHeader(6) to_be_true
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
it 'should return false when not on a table header'
Expect tablemode#table#IsATableHeader(1) to_be_false
Expect tablemode#table#IsATableHeader(2) to_be_false
Expect tablemode#table#IsATableHeader(4) to_be_false
Expect tablemode#table#IsATableHeader(5) to_be_false
end
end
end
end

View File

@@ -34,4 +34,25 @@ describe 'tablemode'
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