Skip to content

Commit

Permalink
Fix a bunch of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Jul 4, 2017
1 parent adf9985 commit cbf3828
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 139 deletions.
37 changes: 19 additions & 18 deletions src/SelectionManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CharMeasure } from './utils/CharMeasure';
import { CircularList } from './utils/CircularList';
import { SelectionManager } from './SelectionManager';
import { SelectionModel } from './SelectionModel';
import { CharData } from "./Types";

class TestSelectionManager extends SelectionManager {
constructor(
Expand Down Expand Up @@ -50,10 +51,10 @@ describe('SelectionManager', () => {
});
});

function stringToRow(text: string): [number, string, number][] {
let result: [number, string, number][] = [];
function stringToRow(text: string): CharData[] {
let result: CharData[] = [];
for (let i = 0; i < text.length; i++) {
result.push([0, text.charAt(i), 1]);
result.push([text.charAt(i), 1, 0, 0, 0]);
}
return result;
}
Expand Down Expand Up @@ -92,21 +93,21 @@ describe('SelectionManager', () => {
it('should expand selection for wide characters', () => {
// Wide characters use a special format
buffer.push([
[null, '中', 2],
[null, '', 0],
[null, '文', 2],
[null, '', 0],
[null, ' ', 1],
[null, 'a', 1],
[null, '中', 2],
[null, '', 0],
[null, '文', 2],
[null, '', 0],
[null, 'b', 1],
[null, ' ', 1],
[null, 'f', 1],
[null, 'o', 1],
[null, 'o', 1]
['中', 2, null, null, null],
['', 0, null, null, null],
['文', 2, null, null, null],
['', 0, null, null, null],
[' ', 1, null, null, null],
['a', 1, null, null, null],
['中', 2, null, null, null],
['', 0, null, null, null],
['文', 2, null, null, null],
['', 0, null, null, null],
['b', 1, null, null, null],
[' ', 1, null, null, null],
['f', 1, null, null, null],
['o', 1, null, null, null],
['o', 1, null, null, null]
]);
// Ensure wide characters take up 2 columns
selectionManager.selectWordAt([0, 0]);
Expand Down
1 change: 0 additions & 1 deletion src/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* @license MIT
*/


/**
* Character data, the array's format is:
* - string: The character.
Expand Down
2 changes: 1 addition & 1 deletion src/test/escape-sequences-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function terminalToString(term) {
for (var line = term.ybase; line < term.ybase + term.rows; line++) {
line_s = '';
for (var cell=0; cell<term.cols; ++cell) {
line_s += term.lines.get(line)[cell][1];
line_s += term.lines.get(line)[cell][0];
}
// rtrim empty cells as xterm does
line_s = line_s.replace(/\s+$/, '');
Expand Down
Loading

0 comments on commit cbf3828

Please sign in to comment.