first commit
This commit is contained in:
51
test/classes.js
Normal file
51
test/classes.js
Normal 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");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user