Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
test code from ansi control character code
var batch_util = {
'utility functions': {
'starts_sequence' : {
'can detect a simple sequence': function() {
assert.ok(ansi.util.starts_sequence('\u001b[foobar'));
},
'rejects something obviously not a sequence': function() {
assert.ok(!ansi.util.starts_sequence('foobar'));
},
'rejects a truncated sequence': function() {
assert.ok(!ansi.util.starts_sequence('\u001b['));
},
'groks undefined': function() {
assert.ok(!ansi.util.starts_sequence());
}
},
'take_first_number': {
'groks undefined': function() {
assert.ok(isNaN(ansi.util.take_first_number()));
}
},
'tokenize_sequence': {
'groks undefined': function() {
var ret = ansi.util.tokenize_sequence();
assert.ok(!ret.sequence);
assert.ok(ret.octets_consumed === 0);
},
'rejects crap': function() {
var ret = ansi.util.tokenize_sequence('abc');
assert.ok(!ret.sequence);
assert.ok(ret.octets_consumed === 0);
},
'handles a simple CUU': function() {
var ret = ansi.util.tokenize_sequence('\u001b[0A');
assert.equal(ret.sequence.opcode, 'A');
assert.equal(ret.sequence.name, 'Cursor Up');
assert.equal(ret.octets_consumed, 4);
assert.equal(ret.sequence.n, 0);
}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.