import { ddescribe, describe, it, iit, xit, expect, beforeEach, afterEach } from 'angular2/testing_internal'; import {BaseException} from 'angular2/src/facade/exceptions'; import { tokenizeHtml, HtmlToken, HtmlTokenType, HtmlTokenError } from 'angular2/src/compiler/html_lexer'; import {ParseSourceSpan, ParseLocation, ParseSourceFile} from 'angular2/src/compiler/parse_util'; export function main() { describe('HtmlLexer', () => { describe('line/column numbers', () => { it('should work without newlines', () => { expect(tokenizeAndHumanizeLineColumn('a')) .toEqual([ [HtmlTokenType.TAG_OPEN_START, '0:0'], [HtmlTokenType.TAG_OPEN_END, '0:2'], [HtmlTokenType.TEXT, '0:3'], [HtmlTokenType.TAG_CLOSE, '0:4'], [HtmlTokenType.EOF, '0:8'] ]); }); it('should work with one newline', () => { expect(tokenizeAndHumanizeLineColumn('\na')) .toEqual([ [HtmlTokenType.TAG_OPEN_START, '0:0'], [HtmlTokenType.TAG_OPEN_END, '0:2'], [HtmlTokenType.TEXT, '0:3'], [HtmlTokenType.TAG_CLOSE, '1:1'], [HtmlTokenType.EOF, '1:5'] ]); }); it('should work with multiple newlines', () => { expect(tokenizeAndHumanizeLineColumn('\na')) .toEqual([ [HtmlTokenType.TAG_OPEN_START, '0:0'], [HtmlTokenType.TAG_OPEN_END, '1:0'], [HtmlTokenType.TEXT, '1:1'], [HtmlTokenType.TAG_CLOSE, '2:1'], [HtmlTokenType.EOF, '2:5'] ]); }); it('should work with CR and LF', () => { expect(tokenizeAndHumanizeLineColumn('\r\na\r')) .toEqual([ [HtmlTokenType.TAG_OPEN_START, '0:0'], [HtmlTokenType.TAG_OPEN_END, '1:0'], [HtmlTokenType.TEXT, '1:1'], [HtmlTokenType.TAG_CLOSE, '2:1'], [HtmlTokenType.EOF, '2:5'] ]); }); }); describe('comments', () => { it('should parse comments', () => { expect(tokenizeAndHumanizeParts('')) .toEqual([ [HtmlTokenType.COMMENT_START], [HtmlTokenType.RAW_TEXT, 't\ne\ns\nt'], [HtmlTokenType.COMMENT_END], [HtmlTokenType.EOF] ]); }); it('should store the locations', () => {expect(tokenizeAndHumanizeSourceSpans('')) .toEqual([ [HtmlTokenType.COMMENT_START, ''], [HtmlTokenType.EOF, ''] ])}); it('should report { expect(tokenizeAndHumanizeErrors(' { expect(tokenizeAndHumanizeErrors('