Skip to content

Commit d963026

Browse files
authored
Create Hatnote list.lua
1 parent 619cefc commit d963026

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

‎Testcases/Hatnote list.lua‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
local mHatnoteList = require('Module:Hatnote list/sandbox') -- the module to be tested
2+
local ScribuntoUnit = require('Module:ScribuntoUnit')
3+
local suite = ScribuntoUnit:new()
4+
5+
function suite:testAndList()
6+
self:assertEquals(
7+
"Foo, Bar, and Baz",
8+
mHatnoteList.andList({"Foo", "Bar", "Baz"})
9+
)
10+
end
11+
12+
function suite:testOrList()
13+
self:assertEquals(
14+
"Foo, Bar, or Baz",
15+
mHatnoteList.orList({"Foo", "Bar", "Baz"})
16+
)
17+
end
18+
19+
function suite:testForSee()
20+
self:assertEquals(
21+
"For Foo, see [[:Bar]]. For Baz, see [[:Qux]].",
22+
mHatnoteList._forSee({"Foo", "Bar", "Baz", "Qux"})
23+
)
24+
end
25+
26+
function suite:testPunctuationCollapse()
27+
self:assertEquals(
28+
"For periods, see [[:Foo.]] and [[:Bar.]] " ..
29+
"For question marks, see [[:Baz?]] and [[:Qux?]] " ..
30+
"For exclamation marks, see [[:Oof!]] and [[:Rab!]]",
31+
mHatnoteList._forSee({
32+
"periods", "Foo.", "and", "Bar.",
33+
"question marks", "Baz?", "and", "Qux?",
34+
"exclamation marks", "Oof!", "and", "Rab!"
35+
})
36+
)
37+
end
38+
39+
function suite:testPunctuationCollapseWithItalics()
40+
self:assertEquals(
41+
"For periods, see [[:Foo.|''Foo.'']] " ..
42+
"For question marks, see [[:Bar?|''Bar?'']] " ..
43+
"For exclamation marks, see [[:Baz!|''Baz!'']]",
44+
mHatnoteList._forSee({
45+
"periods", "Foo.|''Foo.''",
46+
"question marks", "Bar?|''Bar?''",
47+
"exclamation marks", "Baz!|''Baz!''"
48+
})
49+
)
50+
end
51+
52+
return suite

0 commit comments

Comments
 (0)