소스 검색

Add unit tests for #59.

tags/v0.4
Ben Kurtovic 10 년 전
부모
커밋
fc529bdb57
2개의 변경된 파일38개의 추가작업 그리고 3개의 파일을 삭제
  1. +35
    -0
      tests/tokenizer/integration.mwtest
  2. +3
    -3
      tests/tokenizer/templates.mwtest

+ 35
- 0
tests/tokenizer/integration.mwtest 파일 보기

@@ -192,3 +192,38 @@ name: nodes_inside_external_link_after_punct
label: various complex nodes inside an external link following punctuation
input: "http://example.com/foo.{{bar}}baz.&biz;<!--hello-->bingo"
output: [ExternalLinkOpen(brackets=False), Text(text="http://example.com/foo."), TemplateOpen(), Text(text="bar"), TemplateClose(), Text(text="baz.&biz;"), CommentStart(), Text(text="hello"), CommentEnd(), Text(text="bingo"), ExternalLinkClose()]

---

name: newline_and_comment_in_template_name
label: a template name containing a newline followed by a comment
input: "{{foobar\n<!-- comment -->}}"
output: [TemplateOpen(), Text(text="foobar\n"), CommentStart(), Text(text=" comment "), CommentEnd(), TemplateClose()]

---

name: newline_and_comment_in_template_name_2
label: a template name containing a newline followed by a comment
input: "{{foobar\n<!-- comment -->|key=value}}"
output: [TemplateOpen(), Text(text="foobar\n"), CommentStart(), Text(text=" comment "), CommentEnd(), TemplateParamSeparator(), Text(text="key"), TemplateParamEquals(), Text(text="value"), TemplateClose()]

---

name: newline_and_comment_in_template_name_3
label: a template name containing a newline followed by a comment
input: "{{foobar\n<!-- comment -->\n|key=value}}"
output: [TemplateOpen(), Text(text="foobar\n"), CommentStart(), Text(text=" comment "), CommentEnd(), Text(text="\n"), TemplateParamSeparator(), Text(text="key"), TemplateParamEquals(), Text(text="value"), TemplateClose()]

---

name: newline_and_comment_in_template_name_4
label: a template name containing a newline followed by a comment
input: "{{foobar\n<!-- comment -->invalid|key=value}}"
output: [Text(text="{{foobar\n"), CommentStart(), Text(text=" comment "), CommentEnd(), Text(text="invalid|key=value}}")]

---

name: newline_and_comment_in_template_name_5
label: a template name containing a newline followed by a comment
input: "{{foobar\n<!-- comment -->\ninvalid|key=value}}"
output: [Text(text="{{foobar\n"), CommentStart(), Text(text=" comment "), CommentEnd(), Text(text="\ninvalid|key=value}}")]

+ 3
- 3
tests/tokenizer/templates.mwtest 파일 보기

@@ -384,9 +384,9 @@ output: [TemplateOpen(), Text(text="foo\n "), TemplateClose()]
---

name: newlines_spaces_param
label: newlines in the middle of a template name, followed by spaces
input: "{{foo\n }}"
output: [TemplateOpen(), Text(text="foo\n "), TemplateClose()]
label: newlines in the middle of a template name, followed by spaces, with a parameter
input: "{{foo\n |bar=baz}}"
output: [TemplateOpen(), Text(text="foo\n "), TemplateParamSeparator(), Text(text="bar"), TemplateParamEquals(), Text(text="baz"), TemplateClose()]

---



불러오는 중...
취소
저장