1
+ local App = require (" grapple.app" )
1
2
local TagContent = require (" grapple.tag_content" )
2
3
3
4
describe (" TagContent" , function ()
@@ -19,39 +20,47 @@ describe("TagContent", function()
19
20
{ 5 , " /000 " },
20
21
{ 5 , " /000 /some_path" },
21
22
22
- -- ID + name
23
- { 9 , " /001 bob /some_path" },
24
- { 9 , " /002 bob bob" },
25
- { 9 , " /003 bob bob " },
26
- { 9 , " /004 bob " },
27
- { 7 , " /005 a /some_path" },
28
- { 7 , " /006 a " },
29
- { 7 , " /007 a " },
23
+ -- Assumed behaviour (last part editable)
24
+ { 5 , " /000 /some_path /another_path" },
25
+ }
26
+
27
+ for _ , test_case in ipairs (test_cases ) do
28
+ local expected = test_case [1 ]
29
+ local line = test_case [2 ]
30
+
31
+ it (string.format (' expected col %d, line "%s"' , expected , line ), function ()
32
+ local empty = function () end
33
+ local app = App :new ()
34
+ app :update ({ scope = " global" , icons = false })
30
35
36
+ assert .is_same (
37
+ expected ,
38
+ TagContent :new (app , assert (app :current_scope ()), empty , empty , empty ):minimum_column (line )
39
+ )
40
+ end )
41
+ end
42
+
43
+ local test_cases_icons = {
31
44
-- ID + icon
32
45
{ 9 , " /001 /some_path" },
33
46
{ 9 , " /002 /some_path" },
34
47
{ 9 , " /003 /some_path" },
35
48
{ 9 , " /004 " },
36
49
{ 9 , " /005 " },
37
-
38
- -- ID + icon + name
39
- { 13 , " /001 bob /some_path" },
40
- { 13 , " /002 bob " },
41
- { 11 , " /003 c /some_path" },
42
- { 11 , " /004 c " },
43
- { 11 , " /005 c " },
44
-
45
- -- Assumed behaviour (last part editable)
46
- { 16 , " /000 /some_path /another_path" },
47
50
}
48
51
49
- for _ , test_case in ipairs (test_cases ) do
52
+ for _ , test_case in ipairs (test_cases_icons ) do
50
53
local expected = test_case [1 ]
51
54
local line = test_case [2 ]
52
55
53
56
it (string.format (' expected col %d, line "%s"' , expected , line ), function ()
54
- assert .same (expected , TagContent :new (nil , nil , nil , nil ):minimum_column (line ))
57
+ local empty = function () end
58
+ local app = App :new ()
59
+ app :update ({ scope = " global" , icons = true })
60
+ assert .is_same (
61
+ expected ,
62
+ TagContent :new (app , assert (app :current_scope ()), empty , empty , empty ):minimum_column (line )
63
+ )
55
64
end )
56
65
end
57
66
end )
0 commit comments