# jashkenas/coffeescript

removing over-hash-comment

1 parent faf98da commit 9e2c75b548080b69a6ab350424a59af84fd7b221 committed Mar 12, 2011
 @@ -27,7 +27,7 @@ ok result[0][0] is 'a' ok result[1]['b'] is 'c' -#### Splats in Array Literals +# Splats in Array Literals test "array splat expansions with assignments", -> nums = [1, 2, 3]
 @@ -27,7 +27,7 @@ test "compound assignments should not declare", -> eq Math, (-> Math or= 0)() -#### Compound Assignment +# Compound Assignment test "boolean operators", -> nonce = {} @@ -136,7 +136,7 @@ test "more compound assignment", -> eq c, val -#### Destructuring Assignment +# Destructuring Assignment test "empty destructuring assignment", -> {} = [] = undefined @@ -251,7 +251,7 @@ test "#1024", -> eq 2 * [] = 3 + 5, 16 -#### Existential Assignment +# Existential Assignment test "existential assignment", -> nonce = {}
 @@ -110,7 +110,7 @@ test "spaced comments with conditional statements", -> eq nonce, result -#### Block Comments +# Block Comments ### This is a here-comment.
 @@ -341,7 +341,7 @@ test "expression conversion under explicit returns", -> arrayEq [nonce,nonce,nonce], fn() -#### Implicit Destructuring Assignment +# Implicit Destructuring Assignment test "implicit destructuring assignment in object of objects", -> a={}; b={}; c={}
 @@ -14,7 +14,7 @@ # shared identity function id = (_) -> if arguments.length is 1 then _ else Array::slice.call(arguments) -#### Conditionals +# Conditionals test "basic conditionals", -> if false @@ -198,7 +198,7 @@ test "#748: trailing reserved identifiers", -> eq nonce, result -#### For / While / Until / Loop +# For / While / Until / Loop # TODO: refactor while tests @@ -298,7 +298,7 @@ test "break *not* at the top level", -> eq 2, someFunc() -#### Switch +# Switch # TODO: refactor switch tests
 @@ -5,13 +5,13 @@ nonce = {} -#### Throw +# Throw test "basic exception throwing", -> throws (-> throw 'error'), 'error' -#### Empty Try/Catch/Finally +# Empty Try/Catch/Finally test "try can exist alone", -> try @@ -43,7 +43,7 @@ test "single-line try/catch/finally with empty try, empty catch, empty finally", try catch err then finally -#### Try/Catch/Finally as an Expression +# Try/Catch/Finally as an Expression test "return the result of try when no exception is thrown", -> result = try @@ -81,7 +81,7 @@ test "optional catch", -> eq nonce, fn() -#### Try/Catch/Finally Interaction With Other Constructs +# Try/Catch/Finally Interaction With Other Constructs test "try/catch with empty catch as last statement in a function body", -> fn = ->
 @@ -21,7 +21,7 @@ test "multiple semicolon-separated statements in parentheticals", -> eq nonce, (1; 2; nonce) eq nonce, (-> return (1; 2; nonce))() -#### Line Continuation +# Line Continuation # Property Access
 @@ -268,7 +268,7 @@ obj = ok obj[obj.index++].method([]...), 'should cache base value' -#### Splats in Function Invocations +# Splats in Function Invocations test "passing splats to functions", -> arrayEq [0..4], id id [0..4]... @@ -315,7 +315,7 @@ test "#1011: passing a splat to a method of a number", -> eq '1011', (131.0).toString [5]... -#### Implicit Return +# Implicit Return eq ok, new -> ok @@ -355,7 +355,7 @@ test "preserve context when generating closure wrappers for expression conversio eq nonce, obj.property -#### Explicit Returns +# Explicit Returns test "don't wrap \"pure\" statements in a closure", -> nonce = {}
 @@ -11,7 +11,7 @@ # * Parameter Destructuring # * Default Parameters -#### Function Definition +# Function Definition x = 1 y = {} @@ -46,7 +46,7 @@ del = -> 5 ok del() is 5 -#### Bound Function Definition +# Bound Function Definition obj = bound: -> @@ -64,7 +64,7 @@ ok obj isnt obj.unbound() eq obj, obj.nested() -#### Parameter List Features +# Parameter List Features test "splats", -> arrayEq [0, 1, 2], (((splat...) -> splat) 0, 1, 2)
 @@ -5,7 +5,7 @@ {starts, ends, compact, count, merge, extend, flatten, del, last} = CoffeeScript.helpers -#### `starts` +# `starts` test "the `starts` helper tests if a string starts with another string", -> ok starts('01234', '012') @@ -16,7 +16,7 @@ test "the `starts` helper can take an optional offset", -> ok not starts('01234', '01', 1) -#### `ends` +# `ends` test "the `ends` helper tests if a string ends with another string", -> ok ends('01234', '234') @@ -27,15 +27,15 @@ test "the `ends` helper can take an optional offset", -> ok not ends('01234', '234', 6) -#### `compact` +# `compact` test "the `compact` helper removes falsey values from an array, preserves truthy ones", -> allValues = [1, 0, false, obj={}, [], '', ' ', -1, null, undefined, true] truthyValues = [1, obj, [], ' ', -1, true] arrayEq truthyValues, compact(allValues) -#### `count` +# `count` test "the `count` helper counts the number of occurances of a string in another string", -> eq 1/0, count('abc', '') @@ -46,7 +46,7 @@ test "the `count` helper counts the number of occurances of a string in another eq 2, count('abcdabcd','abc') -#### `merge` +# `merge` test "the `merge` helper makes a new object with all properties of the objects given as its arguments", -> ary = [0, 1, 2, 3, 4] @@ -58,7 +58,7 @@ test "the `merge` helper makes a new object with all properties of the objects g eq val, merged[key] -#### `extend` +# `extend` test "the `extend` helper performs a shallow copy", -> ary = [0, 1, 2, 3] @@ -69,23 +69,23 @@ test "the `extend` helper performs a shallow copy", -> eq 2, obj[2] -#### `flatten` +# `flatten` test "the `flatten` helper flattens an array", -> success = yes (success and= typeof n is 'number') for n in flatten [0, [[[1]], 2], 3, [4]] ok success -#### `del` +# `del` test "the `del` helper deletes a property from an object and returns the deleted value", -> obj = [0, 1, 2] eq 1, del(obj, 1) ok 1 not of obj -#### `last` +# `last` test "the `last` helper returns the last item of an array-like object", -> ary = [0, 1, 2, 3, 4]
 @@ -4,7 +4,7 @@ # * String Interpolation # * Regular Expression Interpolation -#### String Interpolation +# String Interpolation # TODO: refactor string interpolation tests @@ -109,7 +109,7 @@ eq 'multiline nested "interpolations" work', """multiline #{ } work""" -#### Regular Expression Interpolation +# Regular Expression Interpolation # TODO: improve heregex interpolation tests
 @@ -9,7 +9,7 @@ # * Non-Integer Literals -#### Decimal Integer Literals +# Decimal Integer Literals test "call methods directly on numbers", -> eq 4, 4.valueOf() @@ -23,7 +23,7 @@ eq Number::toString, 42['toString'] eq Number::toString, 42.toString -#### Non-Integer Literals +# Non-Integer Literals # Decimal number literals. value = .25 + .75
 @@ -59,7 +59,7 @@ test "use `::` operator on keywords `this` and `@`", -> eq nonce, obj.withThis() -#### Existential Operator (Binary) +# Existential Operator (Binary) test "binary existential operator", -> nonce = {} @@ -91,7 +91,7 @@ test "binary existential operator with negative number", -> eq -1, a -#### Existential Operator (Unary) +# Existential Operator (Unary) test "postfix existential operator", -> ok (if nonexistent? then false else true) @@ -114,7 +114,7 @@ test "postfix existential operator on expressions", -> eq true, (1 or 0)?, true -#### `is`,`isnt`,`==`,`!=` +# `is`,`isnt`,`==`,`!=` test "`==` and `is` should be interchangeable", -> a = b = 1 @@ -130,7 +130,7 @@ test "`!=` and `isnt` should be interchangeable", -> ok a isnt b -#### [not] in/of +# [not] in/of # - `in` should check if an array contains a value using `indexOf` # - `of` should check if a property is defined on an object using `in` @@ -185,7 +185,7 @@ test "#768: `in` should preserve evaluation order", -> eq 3, share -#### Chained Comparison +# Chained Comparison test "chainable operators", -> ok 100 > 10 > 1 > 0 > -1
 @@ -35,7 +35,7 @@ test "#584: slashes are allowed unescaped in character classes", -> ok /^a\/[/]b\$/.test 'a//b' -#### Heregexe(n|s) +# Heregexe(n|s) test "a heregex will ignore whitespace and comments", -> eq /^I'm\x20+[a]\s+Heregex?\/\/\//gim + '', ///
 @@ -7,7 +7,7 @@ # shared array shared = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -#### Slicing +# Slicing test "basic slicing", -> arrayEq [7, 8, 9] , shared[7..9] @@ -53,7 +53,7 @@ test "string slicing", -> ok str[-5..] is "vwxyz" -#### Splicing +# Splicing test "basic splicing", -> ary = [0..9]
 @@ -6,7 +6,7 @@ # * Soaked Function Invocation -#### Soaked Property Access +# Soaked Property Access test "soaked property access", -> nonce = {} @@ -73,7 +73,7 @@ test "operations on soaked properties", -> eq yes, delete a?.b.c -#### Soaked Method Invocation +# Soaked Method Invocation test "soaked method invocation", -> nonce = {} @@ -96,7 +96,7 @@ test "#733", -> eq a.b?.c?([2, 3]...), 2 -#### Soaked Function Invocation +# Soaked Function Invocation test "soaked function invocation", -> nonce = {}