first commit

This commit is contained in:
Sebastian McKenzie
2014-09-28 23:39:22 +10:00
commit c97696c224
167 changed files with 2007 additions and 0 deletions

51
test/classes.js Normal file
View File

@@ -0,0 +1,51 @@
var transform = require("../lib/6to5/transform");
var assert = require("assert");
suite("classes", function () {
test("no calling super properties", function () {
assert.throws(function () {
transform.test([
"class Test extends Foo {",
" constructor() {",
" super.test.whatever();",
" }",
"}"
]);
}, /cannot access super properties/, "unexpected error");
});
test("no accessing super properties", function () {
assert.throws(function () {
transform.test([
"class Test extends Foo {",
" constructor() {",
" super.test.whatever;",
" }",
"}"
]);
}, /cannot access super properties/, "unexpected error");
});
test("accessing super without having one", function () {
assert.throws(function () {
transform.test([
"class Test {",
" constructor() {",
" super();",
" }",
"}"
]);
}, /cannot access super as this class has none/, "unexpected error");
});
test("defining constructor as a mutator", function () {
assert.throws(function () {
transform.test([
"class Test {",
" get constructor() {",
" }",
"}"
]);
}, /unknown kind for constructor method/, "unexpected error");
});
});