Fix some naming conventions issues

This commit is contained in:
Daniel Imms
2020-03-28 06:57:55 -07:00
parent 937b551ae4
commit 2c0669c865
3 changed files with 14 additions and 8 deletions
+1
View File
@@ -6,6 +6,7 @@
import { assert } from 'chai';
import { WriteBuffer } from './WriteBuffer';
// eslint-disable-next-line @typescript-eslint/naming-convention
declare let Buffer: any;
function toBytes(s: string): Uint8Array {
@@ -58,6 +58,9 @@ const oscPutParser = new MockOscPutParser();
// derived parser with access to internal states
class TestEscapeSequenceParser extends EscapeSequenceParser {
public get transitions(): TransitionTable {
return this._transitions;
}
public get osc(): string {
return (this._oscParser as MockOscPutParser).data;
}
@@ -192,13 +195,13 @@ describe('EscapeSequenceParser', function (): void {
const parser = testParser;
describe('Parser init and methods', function (): void {
it('constructor', function (): void {
let p: EscapeSequenceParser = new EscapeSequenceParser();
chai.expect(p.TRANSITIONS).equal(VT500_TRANSITION_TABLE);
p = new EscapeSequenceParser(VT500_TRANSITION_TABLE);
chai.expect(p.TRANSITIONS).equal(VT500_TRANSITION_TABLE);
let p = new TestEscapeSequenceParser();
chai.expect(p.transitions).equal(VT500_TRANSITION_TABLE);
p = new TestEscapeSequenceParser(VT500_TRANSITION_TABLE);
chai.expect(p.transitions).equal(VT500_TRANSITION_TABLE);
const tansitions: TransitionTable = new TransitionTable(10);
p = new EscapeSequenceParser(tansitions);
chai.expect(p.TRANSITIONS).equal(tansitions);
p = new TestEscapeSequenceParser(tansitions);
chai.expect(p.transitions).equal(tansitions);
});
it('inital states', function (): void {
chai.expect(parser.initialState).equal(ParserState.GROUND);
+4 -2
View File
@@ -253,7 +253,9 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
protected _escHandlerFb: EscFallbackHandlerType;
protected _errorHandlerFb: (state: IParsingState) => IParsingState;
constructor(readonly TRANSITIONS: TransitionTable = VT500_TRANSITION_TABLE) {
constructor(
protected readonly _transitions: TransitionTable = VT500_TRANSITION_TABLE
) {
super();
this.initialState = ParserState.GROUND;
@@ -471,7 +473,7 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
const dcs = this._dcsParser;
let collect = this._collect;
const params = this._params;
const table: Uint8Array = this.TRANSITIONS.table;
const table: Uint8Array = this._transitions.table;
// process input string
for (let i = 0; i < length; ++i) {