adding an initial lexer test

This commit is contained in:
Jeremy Ashkenas
2009-12-18 06:59:06 -05:00
parent 049358d006
commit 92adabdddc
8 changed files with 120 additions and 4 deletions

11
test/fixtures/each.cs vendored Normal file
View File

@@ -0,0 +1,11 @@
# The cornerstone, an each implementation.
# Handles objects implementing forEach, arrays, and raw objects.
_.each: obj, iterator, context =>
index: 0
try
return obj.forEach(iterator, context) if obj.forEach
return iterator.call(context, item, i, obj) for item, i in obj. if _.isArray(obj) or _.isArguments(obj)
iterator.call(context, obj[key], key, obj) for key in _.keys(obj).
catch e
throw e if e aint breaker.
obj.