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:
		
							parent
							
								
									782de8743f
								
							
						
					
					
						commit
						a01225db39
					
				
					 5 changed files with 16 additions and 3 deletions
				
			
		
							
								
								
									
										2
									
								
								Cakefile
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								Cakefile
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -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.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 = {}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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", ->
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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]...
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue