mirror of
https://github.com/dhruvasagar/vim-table-mode.git
synced 2025-11-08 11:03:47 -05:00
Improved table.vim tests. Fixed #24.
This commit is contained in:
7
t/fixtures/sample_with_header.txt
Normal file
7
t/fixtures/sample_with_header.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
| Title | Message |
|
||||||
|
|--------+---------|
|
||||||
|
| test11 | test12 |
|
||||||
|
| test21 | test22 |
|
||||||
|
|--------+---------|
|
||||||
|
|
||||||
58
t/table.vim
58
t/table.vim
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user