Skip to content

Commit

Permalink
fixing test.html
Browse files Browse the repository at this point in the history
  • Loading branch information
jashkenas committed May 1, 2011
1 parent 43ebec1 commit 5fd82e8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 26 deletions.
2 changes: 1 addition & 1 deletion extras/coffee-script.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion lib/browser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/browser.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ CoffeeScript.load = (url, callback) ->
xhr.overrideMimeType 'text/plain' if 'overrideMimeType' of xhr
xhr.onreadystatechange = ->
if xhr.readyState is 4
if xhr.status is 200
if xhr.status in [0, 200]
CoffeeScript.run xhr.responseText
else
throw new Error "Could not load #{url}"
callback() if callback
callback() if callback
xhr.send null

# Activate CoffeeScript in the browser by having it compile and evaluate
Expand Down
2 changes: 1 addition & 1 deletion test/function_invocation.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ test "Prefix unary assignment operators are allowed in parenless calls.", ->
ok (func --val) is 5

test "#855: execution context for `func arr...` should be `null`", ->
contextTest = -> eq @, global
contextTest = -> eq @, if window? then window else global

This comment has been minimized.

Copy link
@michaelficarra

michaelficarra May 1, 2011

Collaborator

I think this should be changed back to global and you should add global ?= this at the top.

array = []
contextTest array
contextTest.apply null, array
Expand Down
32 changes: 11 additions & 21 deletions test/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ <h1>CoffeeScript Test Suite</h1>
start = new Date
success = total = done = failed = 0

say = (msg, yay) ->
say = (msg) ->
div = document.createElement 'div'
div.appendChild document.createTextNode msg
div.style.color = if yay then 'green' else 'red'
stdout.appendChild div
msg

Expand Down Expand Up @@ -72,16 +71,9 @@ <h1>CoffeeScript Test Suite</h1>
return
ok no


CoffeeScript.run = (code, cb) ->
try Function(CoffeeScript.compile code, wrap: no)()
catch e then cb(); throw e
cb yes

run = (name) ->
CoffeeScript.load "#{name}.coffee", (yay) ->
say "#{ if yay then '\u2714' else '\u3000' } #{name}", yay
++failed unless yay
CoffeeScript.load "#{name}.coffee", ->
say '\u2714 ' + name
fin() if ++done is names.length

fin = ->
Expand All @@ -92,35 +84,33 @@ <h1>CoffeeScript Test Suite</h1>
say msg, yay

run name for name in names = [
'array_literals'
'arrays'
'assignment'
'boolean_literals'
'cake'
'booleans'
'classes'
'command'
'comments'
'compilation'
'comprehensions'
'control_flow'
'exception_handling'
'formatting'
'function_invocation'
'function_literals'
'functions'
'helpers'
'importing'
'interpolation'
'javascript_literals'
'number_literals'
'object_literals'
'numbers'
'objects'
'operators'
'option_parser'
'range_literals'
'regular_expression_literals'
'ranges'
'regexps'
'repl'
'scope'
'slicing_and_splicing'
'soaks'
'string_literals'
'strings'
]
</script>

Expand Down

0 comments on commit 5fd82e8

Please sign in to comment.