MCPcopy
hub / github.com/autoNumeric/autoNumeric / testTokenizer

Function testTokenizer

test/unit/autoNumeric.spec.js:8954–8965  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

8952describe(`The Math expression lexer and parser`, () => {
8953 it(`should correctly tokenize the math expressions`, () => {
8954 function testTokenizer(text) {
8955 const lexer = new Lexer(text);
8956 const tokens = [];
8957 let token;
8958
8959 do {
8960 token = lexer.getNextToken();
8961 tokens.push(token);
8962 } while (token.type !== 'EOT');
8963
8964 return tokens;
8965 }
8966
8967 expect(testTokenizer('2 + 6').length).toEqual(4);
8968 expect(testTokenizer('2 - 6').length).toEqual(4);

Callers 1

Calls 1

getNextTokenMethod · 0.95

Tested by

no test coverage detected