This commit is contained in:
Daniel Imms
2016-11-27 03:27:36 -08:00
parent 61fbbb0054
commit 607c819109
4 changed files with 115 additions and 105 deletions
+7 -3
View File
@@ -59,7 +59,7 @@ function terminalToString(term) {
for (var line=0; line<term.rows; ++line) {
line_s = '';
for (var cell=0; cell<term.cols; ++cell) {
line_s += term.lines[line][cell][1];
line_s += term.lines.get(line)[cell][1];
}
// rtrim empty cells as xterm does
line_s = line_s.replace(/\s+$/, '');
@@ -83,21 +83,25 @@ describe('xterm output comparison', function() {
var files = glob.sync('**/escape_sequence_files/*.in');
// only successful tests for now
var successful = [0, 2, 6, 12, 13, 18, 20, 22, 27, 28];
console.log(files);
for (var a in successful) {
var i = successful[a];
(function(filename){
it(filename.split('/').slice(-1)[0], function () {
console.log(filename);
pty_reset();
console.log(1);
var in_file = fs.readFileSync(filename, 'utf8');
var from_pty = pty_write_read(in_file);
console.log(2);
// uncomment this to get log from terminal
console.log = function(){};
//console.log = function(){};
xterm.write(from_pty);
var from_emulator = terminalToString(xterm);
console.log(3);
console.log = CONSOLE_LOG;
var expected = fs.readFileSync(filename.split('.')[0] + '.text', 'utf8');
if (from_emulator != expected) {
console.log(4);
// uncomment to get noisy output
//throw new Error(formatError(in_file, from_emulator, expected));
throw new Error('mismatch');