Skip to content

Commit 9136e15

Browse files
committed
Added test for Extension decorator instantiation throw
1 parent 845529e commit 9136e15

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

test/unit/decoratorMetaExtension.spec.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Expect, Test, TestCase } from "alsatian";
1+
import { Expect, Test } from "alsatian";
22
import * as util from "../src/util";
33

44
import { TranspileError } from "../../src/Errors";
@@ -44,4 +44,20 @@ export class DecoratorMetaExtension {
4444
}).toThrowError(TranspileError,
4545
"!MetaExtension requires the extension of the metatable class.");
4646
}
47+
48+
@Test("DontAllowInstantiation")
49+
public dontAllowInstantiation(): void {
50+
Expect(() => {
51+
util.transpileString(
52+
`
53+
declare class _LOADED;
54+
/** !MetaExtension */
55+
class Ext extends _LOADED {
56+
}
57+
const e = new Ext();
58+
`
59+
);
60+
}).toThrowError(TranspileError,
61+
"Cannot construct classes with decorator '!Extension' or '!MetaExtension'.");
62+
}
4763
}

0 commit comments

Comments
 (0)