Merge: doc: fixed some typos and other misc. corrections
[nit.git] / lib / markdown / test_wikilinks.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Test suites for module `markdown`
16 module test_wikilinks is test
17
18 import test_markdown
19 import wikilinks
20
21 class TestTokenWikilink
22 test
23
24 fun test_token_location1 is test do
25 var string = "[[wikilink]]"
26 var stack = ["TokenWikiLink at 1,1--1,1"]
27 (new TestTokenProcessor(stack)).process(string)
28 end
29
30 fun test_token_location2 is test do
31 var string = "Hello [[World]]"
32 var stack = ["TokenWikiLink at 1,7--1,7"]
33 (new TestTokenProcessor(stack)).process(string)
34 end
35
36 fun test_token_location3 is test do
37 var string = "\nHello\nworld [[wikilink]] !"
38 var stack = ["TokenWikiLink at 3,7--3,7"]
39 (new TestTokenProcessor(stack)).process(string)
40 end
41
42 fun test_token_location4 is test do
43 var string = "[[link1]]\n\n[[link2]]"
44 var stack = [
45 "TokenWikiLink at 1,1--1,1",
46 "TokenWikiLink at 3,1--3,1"]
47 (new TestTokenProcessor(stack)).process(string)
48 end
49
50 fun test_token_location5 is test do
51 var string = "[[link1]]\n[[link2]]"
52 var stack = [
53 "TokenWikiLink at 1,1--1,1",
54 "TokenWikiLink at 2,1--2,1"]
55 (new TestTokenProcessor(stack)).process(string)
56 end
57
58 fun test_token_location6 is test do
59 var string = """
60 [[doc: github]]
61
62 [[loollll]]
63
64 ## Accessing the API
65
66 [[doc: GithubAPI]]"""
67 var stack = [
68 "TokenWikiLink at 1,1--1,1",
69 "TokenWikiLink at 3,1--3,1",
70 "TokenWikiLink at 7,1--7,1"]
71 (new TestTokenProcessor(stack)).process(string)
72 end
73 end