1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

moving global identity function back into just the files in which it is

used
This commit is contained in:
Michael Ficarra 2010-12-18 15:04:47 -05:00
parent 782de8743f
commit a01225db39
5 changed files with 16 additions and 3 deletions

View file

@ -158,8 +158,6 @@ runTests = (CoffeeScript) ->
# Convenience aliases.
global.eq = global.strictEqual
global.id = (_) ->
if arguments.length is 1 then _ else Array::slice.call(arguments)
global.CoffeeScript = CoffeeScript
# Our test helper function for delimiting different test cases.

View file

@ -1,6 +1,9 @@
# Arguments
# ---------
# shared identity function
id = (_) -> if arguments.length is 1 then _ else Array::slice.call(arguments)
test "basic argument passing tests", ->
a = {}
b = {}

View file

@ -1,6 +1,9 @@
# Conditionals
# ------------
# shared identity function
id = (_) -> if arguments.length is 1 then _ else Array::slice.call(arguments)
#### Basic Conditionals
test "basic conditionals", ->

View file

@ -1,3 +1,11 @@
# Chaining
# --------
# shared identity function
id = (_) -> if arguments.length is 1 then _ else Array::slice.call(arguments)
# Basic chained function calls.
identityWrap = (x) ->
-> x

View file

@ -1,8 +1,9 @@
# Splats
# ------
# note: splats in parameter lists of function definitions are tested in `arguments.coffee`
# shared identity function
id = (_) -> if arguments.length is 1 then _ else Array::slice.call(arguments)
test "passing splats to functions", ->
arrayEq [0..4], id id [0..4]...