@@ -4,24 +4,35 @@ local CDN = require("Tests.TOC.CDN")
4
4
local transform = require (" transform" )
5
5
local bold = transform .bold
6
6
7
- local cdnResponseText = C_FileSystem .ReadFile (arg [1 ])
8
- C_FileSystem .Delete (arg [1 ])
9
- local coreAddonVersion = arg [2 ]
10
- local optionsAddonVersion = arg [3 ]
7
+ local cdnResponseTexts = {
8
+ C_FileSystem .ReadFile (arg [1 ]),
9
+ C_FileSystem .ReadFile (arg [2 ]),
10
+ C_FileSystem .ReadFile (arg [3 ]),
11
+ }
11
12
12
- printf (" Parsing CDN response:\n %s" , transform .cyan (cdnResponseText ))
13
- local response = CDN :ParseResponseText (cdnResponseText )
14
- printf (transform .yellow (" Sequence number: %d" ), response .sequenceNumber )
15
- printf (transform .yellow (" Region keys: %s" ), dump (table .keys (response .productInfoByRegion ), { silent = true }))
13
+ assert (C_FileSystem .Delete (arg [1 ]))
14
+ assert (C_FileSystem .Delete (arg [2 ]))
15
+ assert (C_FileSystem .Delete (arg [3 ]))
16
16
17
- print ()
17
+ local cdnResponses = {}
18
+
19
+ for index , cdnResponseText in ipairs (cdnResponseTexts ) do
20
+ printf (" Parsing CDN response:\n %s" , transform .cyan (cdnResponseText ))
21
+ local response = CDN :ParseResponseText (cdnResponseText )
22
+ printf (transform .yellow (" Sequence number: %d" ), response .sequenceNumber )
23
+ printf (transform .yellow (" Region keys: %s" ), dump (table .keys (response .productInfoByRegion ), { silent = true }))
24
+
25
+ print ()
18
26
19
- for regionKey , productInfo in pairs (response .productInfoByRegion ) do
20
- if regionKey == " us" then
21
- for key , value in pairs (productInfo ) do
22
- printf (bold (" %s" ) .. " : %s" , key , value )
27
+ for regionKey , productInfo in pairs (response .productInfoByRegion ) do
28
+ if regionKey == " us" then
29
+ for key , value in pairs (productInfo ) do
30
+ printf (bold (" %s" ) .. " : %s" , key , value )
31
+ end
23
32
end
24
33
end
34
+
35
+ table.insert (cdnResponses , response )
25
36
end
26
37
27
38
print ()
@@ -35,27 +46,30 @@ for moduleName, tocFilePath in pairs(tocFiles) do
35
46
local tocFileContents = C_FileSystem .ReadFile (tocFilePath )
36
47
printf (" Processing TOC file: %s -> %s" , bold (moduleName ), bold (tocFilePath ))
37
48
local toc = BlizzardTOC :DecodeFileContents (tocFileContents )
49
+ assert (# toc [" Interface" ] == # cdnResponses , " Expected one TOC version per supported product line" )
50
+
51
+ for index , response in ipairs (cdnResponses ) do
52
+ local tocInterfaceVersion = toc [" Interface" ][index ]
53
+ printf (bold (" Detected interface version: %s" ), tocInterfaceVersion )
54
+
55
+ -- Assumes the US CDN is authoritative (should be the earliest to update?)
56
+ local usVersionName = response .productInfoByRegion .us .VersionsName
57
+ local latestInterfaceVersion = assert (CDN :VersionNameToInterfaceVersion (usVersionName ))
38
58
39
- local tocInterfaceVersion = toc [" Interface" ]
40
- printf (bold (" Detected interface version: %d" ), tocInterfaceVersion )
41
-
42
- -- Assumes the US CDN is authoritative (should be the earliest to update?)
43
- local usVersionName = response .productInfoByRegion .us .VersionsName
44
- local latestInterfaceVersion = CDN :VersionNameToInterfaceVersion (usVersionName )
45
-
46
- if tocInterfaceVersion ~= latestInterfaceVersion then
47
- local errorMessage = format (
48
- " ✗ Local TOC interface version %d does NOT match Blizzard CDN version %d" ,
49
- tocInterfaceVersion ,
50
- latestInterfaceVersion
51
- )
52
- error (transform .red (errorMessage ))
53
- else
54
- printf (
55
- transform .green (" ✓ Local TOC interface version %d matches Blizzard CDN version %d" ),
56
- tocInterfaceVersion ,
57
- latestInterfaceVersion
58
- )
59
+ if tocInterfaceVersion ~= latestInterfaceVersion then
60
+ local errorMessage = format (
61
+ " ✗ Local TOC interface version %d does NOT match Blizzard CDN version %d" ,
62
+ tocInterfaceVersion ,
63
+ latestInterfaceVersion
64
+ )
65
+ error (transform .red (errorMessage ))
66
+ else
67
+ printf (
68
+ transform .green (" ✓ Local TOC interface version %d matches Blizzard CDN version %d" ),
69
+ tocInterfaceVersion ,
70
+ latestInterfaceVersion
71
+ )
72
+ end
73
+ print ()
59
74
end
60
- print ()
61
75
end
0 commit comments