michael@0: var samples = [ michael@0: "[...a]", michael@0: "[...[1]]", michael@0: "[1, ...a, 2]", michael@0: "[1, ...[2, 3], 4]", michael@0: "[...[1], , ]", michael@0: "[1, , ...[2]]", michael@0: "[, 1, ...[2], ...[3], , 4, 5, , ]" michael@0: ]; michael@0: for (var sample of samples) { michael@0: var source = "function f() {\n return " + sample + ";\n}"; michael@0: eval(source); michael@0: assertEq(f.toString(), source); michael@0: }