Rename Build.Test to Test.
This commit is contained in:
parent
5cb0c1a213
commit
2450d04173
2
Makefile
2
Makefile
@ -45,7 +45,7 @@ sources := $(foreach d,$(source_directories),$(call sort_directory,$(d)))
|
|||||||
|
|
||||||
uses_tests_enabled := \
|
uses_tests_enabled := \
|
||||||
src/classes/Post.coffee \
|
src/classes/Post.coffee \
|
||||||
src/General/Build.Test.coffee \
|
src/General/Test.coffee \
|
||||||
src/Linkification/Linkify.coffee \
|
src/Linkification/Linkify.coffee \
|
||||||
src/Miscellaneous/Keybinds.coffee \
|
src/Miscellaneous/Keybinds.coffee \
|
||||||
src/Monitoring/Unread.coffee \
|
src/Monitoring/Unread.coffee \
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<% if (readJSON('/.tests_enabled')) { %>
|
<% if (readJSON('/.tests_enabled')) { %>
|
||||||
Build.Test =
|
Test =
|
||||||
init: ->
|
init: ->
|
||||||
return if !Conf['Menu'] or g.VIEW not in ['index', 'thread']
|
return if !Conf['Menu'] or g.VIEW not in ['index', 'thread']
|
||||||
|
|
||||||
@ -60,11 +60,11 @@ Build.Test =
|
|||||||
x2 = x.childNodes[i]
|
x2 = x.childNodes[i]
|
||||||
y2 = y.childNodes[i]
|
y2 = y.childNodes[i]
|
||||||
return [x2, y2] unless x2 and y2
|
return [x2, y2] unless x2 and y2
|
||||||
return Build.Test.firstDiff(x2, y2) unless x2.isEqualNode y2
|
return Test.firstDiff(x2, y2) unless x2.isEqualNode y2
|
||||||
i++
|
i++
|
||||||
|
|
||||||
testOne: (post) ->
|
testOne: (post) ->
|
||||||
Build.Test.postsRemaining++
|
Test.postsRemaining++
|
||||||
$.cache Site.urls.threadJSON({boardID: post.boardID, threadID: post.threadID}), ->
|
$.cache Site.urls.threadJSON({boardID: post.boardID, threadID: post.threadID}), ->
|
||||||
return unless @response
|
return unless @response
|
||||||
{posts} = @response
|
{posts} = @response
|
||||||
@ -75,7 +75,7 @@ Build.Test =
|
|||||||
obj = Build.parseJSON postData, post.board.ID
|
obj = Build.parseJSON postData, post.board.ID
|
||||||
root = Build.post obj
|
root = Build.post obj
|
||||||
t2 = new Date().getTime()
|
t2 = new Date().getTime()
|
||||||
Build.Test.time += t2 - t1
|
Test.time += t2 - t1
|
||||||
post2 = new Post root, post.thread, post.board, 'forBuildTest'
|
post2 = new Post root, post.thread, post.board, 'forBuildTest'
|
||||||
fail = false
|
fail = false
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ Build.Test =
|
|||||||
unless x.isEqualNode y
|
unless x.isEqualNode y
|
||||||
fail = true
|
fail = true
|
||||||
c.log "#{post.fullID} differs"
|
c.log "#{post.fullID} differs"
|
||||||
[x2, y2] = Build.Test.firstDiff x, y
|
[x2, y2] = Test.firstDiff x, y
|
||||||
c.log x2
|
c.log x2
|
||||||
c.log y2
|
c.log y2
|
||||||
c.log x.outerHTML
|
c.log x.outerHTML
|
||||||
@ -100,18 +100,18 @@ Build.Test =
|
|||||||
c.log val2
|
c.log val2
|
||||||
|
|
||||||
if fail
|
if fail
|
||||||
Build.Test.postsFailed++
|
Test.postsFailed++
|
||||||
else
|
else
|
||||||
c.log "#{post.fullID} correct"
|
c.log "#{post.fullID} correct"
|
||||||
Build.Test.postsRemaining--
|
Test.postsRemaining--
|
||||||
Build.Test.report() if Build.Test.postsRemaining is 0
|
Test.report() if Test.postsRemaining is 0
|
||||||
return
|
return
|
||||||
|
|
||||||
testAll: ->
|
testAll: ->
|
||||||
g.posts.forEach (post) ->
|
g.posts.forEach (post) ->
|
||||||
unless post.isClone or post.isFetchedQuote
|
unless post.isClone or post.isFetchedQuote
|
||||||
if not ((abbr = $ '.abbr', post.nodes.comment) and /Comment too long\./.test(abbr.textContent))
|
if not ((abbr = $ '.abbr', post.nodes.comment) and /Comment too long\./.test(abbr.textContent))
|
||||||
Build.Test.testOne post
|
Test.testOne post
|
||||||
return
|
return
|
||||||
|
|
||||||
postsRemaining: 0
|
postsRemaining: 0
|
||||||
@ -119,18 +119,18 @@ Build.Test =
|
|||||||
time: 0
|
time: 0
|
||||||
|
|
||||||
report: ->
|
report: ->
|
||||||
if Build.Test.postsFailed
|
if Test.postsFailed
|
||||||
new Notice 'warning', "#{Build.Test.postsFailed} post(s) differ (#{Build.Test.time} ms)", 30
|
new Notice 'warning', "#{Test.postsFailed} post(s) differ (#{Test.time} ms)", 30
|
||||||
else
|
else
|
||||||
new Notice 'success', "All correct (#{Build.Test.time} ms)", 5
|
new Notice 'success', "All correct (#{Test.time} ms)", 5
|
||||||
Build.Test.postsFailed = Build.Test.time = 0
|
Test.postsFailed = Test.time = 0
|
||||||
|
|
||||||
cb:
|
cb:
|
||||||
testOne: ->
|
testOne: ->
|
||||||
Build.Test.testOne g.posts[@dataset.fullID]
|
Test.testOne g.posts[@dataset.fullID]
|
||||||
Menu.menu.close()
|
Menu.menu.close()
|
||||||
|
|
||||||
testAll: ->
|
testAll: ->
|
||||||
Build.Test.testAll()
|
Test.testAll()
|
||||||
Header.menu.close()
|
Header.menu.close()
|
||||||
<% } %>
|
<% } %>
|
||||||
@ -221,7 +221,7 @@ Keybinds =
|
|||||||
<% if (readJSON('/.tests_enabled')) { %>
|
<% if (readJSON('/.tests_enabled')) { %>
|
||||||
when 'v'
|
when 'v'
|
||||||
return unless threadRoot
|
return unless threadRoot
|
||||||
Build.Test.testAll()
|
Test.testAll()
|
||||||
<% } %>
|
<% } %>
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
|
|||||||
@ -3,7 +3,7 @@ class Post
|
|||||||
|
|
||||||
constructor: (root, @thread, @board) ->
|
constructor: (root, @thread, @board) ->
|
||||||
<% if (readJSON('/.tests_enabled')) { %>
|
<% if (readJSON('/.tests_enabled')) { %>
|
||||||
@normalizedOriginal = Build.Test.normalize root
|
@normalizedOriginal = Test.normalize root
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
@ID = +root.id.match(/\d*$/)[0]
|
@ID = +root.id.match(/\d*$/)[0]
|
||||||
|
|||||||
@ -603,6 +603,6 @@ Main =
|
|||||||
['Flash Features', Flash]
|
['Flash Features', Flash]
|
||||||
['Reply Pruning', ReplyPruning]
|
['Reply Pruning', ReplyPruning]
|
||||||
<% if (readJSON('/.tests_enabled')) { %>
|
<% if (readJSON('/.tests_enabled')) { %>
|
||||||
['Build Test', Build.Test]
|
['Build Test', Test]
|
||||||
<% } %>
|
<% } %>
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user