From e348da6a8d81ef9d2f8be7739bc99d799dbe28c0 Mon Sep 17 00:00:00 2001 From: lolleko Date: Mon, 19 Mar 2018 00:34:24 +0100 Subject: [PATCH 1/3] Test refactoring --- test/integration/classConstruction.spec.ts | 25 --- test/integration/classInstanceCalls.spec.ts | 49 ------ test/integration/compiler.spec.ts | 39 ----- test/integration/decorators.spec.ts | 61 ------- test/integration/lua/modules.spec.ts | 159 ------------------ test/integration/namespace.spec.ts | 32 ---- .../integration/project/nested/folder/file.ts | 1 - .../project/tsconfig.bothDirOptions.json | 7 - .../integration/project/tsconfig.default.json | 3 - test/integration/project/tsconfig.outDir.json | 6 - .../integration/project/tsconfig.rootDir.json | 6 - test/integration/testfiles/aliasAsCall.ts | 8 - test/integration/testfiles/aliasCall.lua | 2 - test/integration/testfiles/aliasCastCall.ts | 8 - test/integration/tryStatement.spec.ts | 31 ---- test/transformation/builder.spec.ts | 52 ++++++ .../lua}/assignmentDestructing.lua | 0 .../lua}/callNamespace.lua | 0 .../lua}/class.lua | 0 .../lua}/classEmptyConstructor.lua | 0 .../lua}/classExtension.lua | 0 .../lua/classInstanceCall1.lua} | 0 .../transformation/lua/classInstanceCall2.lua | 1 + .../transformation/lua/classInstanceCall3.lua | 1 + .../lua}/classInstanceCall4.lua | 0 .../lua}/classPureAbstract.lua | 0 .../lua}/classRegularConstructor.lua | 0 .../testfiles => transformation/lua}/enum.lua | 0 .../lua}/enumMembersOnly.lua | 0 .../transformation/lua/modulesClassExport.lua | 10 ++ .../lua/modulesClassWithMemberExport.lua | 12 ++ .../lua/modulesFunctionExport.lua | 5 + .../lua/modulesFunctionNoExport.lua | 2 + test/transformation/lua/modulesImportAll.lua | 1 + .../transformation/lua/modulesImportNamed.lua | 2 + .../lua/modulesImportRenamed.lua | 2 + .../lua/modulesNamespaceExport.lua | 6 + .../lua/modulesNamespaceNoExport.lua | 3 + .../lua/modulesNamespaceWithMemberExport.lua | 10 ++ .../modulesNamespaceWithMemberNoExport.lua | 9 + .../lua/modulesVariableExport.lua | 5 + .../lua/modulesVariableNoExport.lua | 1 + .../lua}/namespace.lua | 0 .../lua}/namespaceNested.lua | 0 .../lua}/namespacePhantom.lua | 0 .../lua}/tryCatch.lua | 0 .../lua}/tryCatchFinally.lua | 0 .../lua}/tryFinally.lua | 0 .../lua}/tupleReturnAssignment.lua | 0 .../lua}/tupleReturnDefinition.lua | 0 .../ts}/assignmentDestructing.ts | 0 .../ts}/callNamespace.ts | 0 .../testfiles => transformation/ts}/class.ts | 0 .../ts}/classEmptyConstructor.ts | 0 .../ts}/classExtension.ts | 0 .../ts}/classInstanceCall1.ts | 0 .../ts}/classInstanceCall2.ts | 0 .../ts}/classInstanceCall3.ts | 0 .../ts}/classInstanceCall4.ts | 0 .../ts}/classPureAbstract.ts | 0 .../ts}/classRegularConstructor.ts | 0 .../testfiles => transformation/ts}/enum.ts | 0 .../ts}/enumMembersOnly.ts | 0 test/transformation/ts/modulesClassExport.ts | 1 + .../ts/modulesClassWithMemberExport.ts | 3 + .../ts/modulesFunctionExport.ts | 1 + .../ts/modulesFunctionNoExport.ts | 1 + test/transformation/ts/modulesImportAll.ts | 1 + test/transformation/ts/modulesImportNamed.ts | 1 + .../transformation/ts/modulesImportRenamed.ts | 1 + .../ts/modulesNamespaceExport.ts | 1 + .../ts/modulesNamespaceNoExport.ts | 1 + .../ts/modulesNamespaceWithMemberExport.ts | 3 + .../ts/modulesNamespaceWithMemberNoExport.ts | 3 + .../ts/modulesVariableExport.ts | 1 + .../ts/modulesVariableNoExport.ts | 1 + .../ts}/namespace.ts | 0 .../ts}/namespaceNested.ts | 0 .../ts}/namespacePhantom.ts | 0 .../ts}/tryCatch.ts | 0 .../ts}/tryCatchFinally.ts | 0 .../ts}/tryFinally.ts | 0 .../ts}/tupleReturnAssignment.ts | 0 .../ts}/tupleReturnDefinition.ts | 0 test/tsconfig.json | 3 +- .../{integration => unit}/assignments.spec.ts | 12 -- test/{integration => unit}/cli.spec.ts | 0 .../lua => unit}/conditionals.spec.ts | 2 +- test/{integration/lua => unit}/curry.spec.ts | 2 +- test/{integration/lua => unit}/error.spec.ts | 2 +- test/unit/expressions.spec.ts | 2 - test/{integration/lua => unit}/loops.spec.ts | 2 +- test/{integration/lua => unit}/lualib.spec.ts | 2 +- test/{integration/lua => unit}/math.spec.ts | 2 +- test/unit/modules.spec.ts | 23 +++ test/{integration/lua => unit}/string.spec.ts | 2 +- 96 files changed, 172 insertions(+), 460 deletions(-) delete mode 100644 test/integration/classConstruction.spec.ts delete mode 100644 test/integration/classInstanceCalls.spec.ts delete mode 100644 test/integration/compiler.spec.ts delete mode 100644 test/integration/decorators.spec.ts delete mode 100644 test/integration/lua/modules.spec.ts delete mode 100644 test/integration/namespace.spec.ts delete mode 100644 test/integration/project/nested/folder/file.ts delete mode 100644 test/integration/project/tsconfig.bothDirOptions.json delete mode 100644 test/integration/project/tsconfig.default.json delete mode 100644 test/integration/project/tsconfig.outDir.json delete mode 100644 test/integration/project/tsconfig.rootDir.json delete mode 100644 test/integration/testfiles/aliasAsCall.ts delete mode 100644 test/integration/testfiles/aliasCall.lua delete mode 100644 test/integration/testfiles/aliasCastCall.ts delete mode 100644 test/integration/tryStatement.spec.ts create mode 100644 test/transformation/builder.spec.ts rename test/{integration/testfiles => transformation/lua}/assignmentDestructing.lua (100%) rename test/{integration/testfiles => transformation/lua}/callNamespace.lua (100%) rename test/{integration/testfiles => transformation/lua}/class.lua (100%) rename test/{integration/testfiles => transformation/lua}/classEmptyConstructor.lua (100%) rename test/{integration/testfiles => transformation/lua}/classExtension.lua (100%) rename test/{integration/testfiles/classInstanceCall.lua => transformation/lua/classInstanceCall1.lua} (100%) create mode 100644 test/transformation/lua/classInstanceCall2.lua create mode 100644 test/transformation/lua/classInstanceCall3.lua rename test/{integration/testfiles => transformation/lua}/classInstanceCall4.lua (100%) rename test/{integration/testfiles => transformation/lua}/classPureAbstract.lua (100%) rename test/{integration/testfiles => transformation/lua}/classRegularConstructor.lua (100%) rename test/{integration/testfiles => transformation/lua}/enum.lua (100%) rename test/{integration/testfiles => transformation/lua}/enumMembersOnly.lua (100%) create mode 100644 test/transformation/lua/modulesClassExport.lua create mode 100644 test/transformation/lua/modulesClassWithMemberExport.lua create mode 100644 test/transformation/lua/modulesFunctionExport.lua create mode 100644 test/transformation/lua/modulesFunctionNoExport.lua create mode 100644 test/transformation/lua/modulesImportAll.lua create mode 100644 test/transformation/lua/modulesImportNamed.lua create mode 100644 test/transformation/lua/modulesImportRenamed.lua create mode 100644 test/transformation/lua/modulesNamespaceExport.lua create mode 100644 test/transformation/lua/modulesNamespaceNoExport.lua create mode 100644 test/transformation/lua/modulesNamespaceWithMemberExport.lua create mode 100644 test/transformation/lua/modulesNamespaceWithMemberNoExport.lua create mode 100644 test/transformation/lua/modulesVariableExport.lua create mode 100644 test/transformation/lua/modulesVariableNoExport.lua rename test/{integration/testfiles => transformation/lua}/namespace.lua (100%) rename test/{integration/testfiles => transformation/lua}/namespaceNested.lua (100%) rename test/{integration/testfiles => transformation/lua}/namespacePhantom.lua (100%) rename test/{integration/testfiles => transformation/lua}/tryCatch.lua (100%) rename test/{integration/testfiles => transformation/lua}/tryCatchFinally.lua (100%) rename test/{integration/testfiles => transformation/lua}/tryFinally.lua (100%) rename test/{integration/testfiles => transformation/lua}/tupleReturnAssignment.lua (100%) rename test/{integration/testfiles => transformation/lua}/tupleReturnDefinition.lua (100%) rename test/{integration/testfiles => transformation/ts}/assignmentDestructing.ts (100%) rename test/{integration/testfiles => transformation/ts}/callNamespace.ts (100%) rename test/{integration/testfiles => transformation/ts}/class.ts (100%) rename test/{integration/testfiles => transformation/ts}/classEmptyConstructor.ts (100%) rename test/{integration/testfiles => transformation/ts}/classExtension.ts (100%) rename test/{integration/testfiles => transformation/ts}/classInstanceCall1.ts (100%) rename test/{integration/testfiles => transformation/ts}/classInstanceCall2.ts (100%) rename test/{integration/testfiles => transformation/ts}/classInstanceCall3.ts (100%) rename test/{integration/testfiles => transformation/ts}/classInstanceCall4.ts (100%) rename test/{integration/testfiles => transformation/ts}/classPureAbstract.ts (100%) rename test/{integration/testfiles => transformation/ts}/classRegularConstructor.ts (100%) rename test/{integration/testfiles => transformation/ts}/enum.ts (100%) rename test/{integration/testfiles => transformation/ts}/enumMembersOnly.ts (100%) create mode 100644 test/transformation/ts/modulesClassExport.ts create mode 100644 test/transformation/ts/modulesClassWithMemberExport.ts create mode 100644 test/transformation/ts/modulesFunctionExport.ts create mode 100644 test/transformation/ts/modulesFunctionNoExport.ts create mode 100644 test/transformation/ts/modulesImportAll.ts create mode 100644 test/transformation/ts/modulesImportNamed.ts create mode 100644 test/transformation/ts/modulesImportRenamed.ts create mode 100644 test/transformation/ts/modulesNamespaceExport.ts create mode 100644 test/transformation/ts/modulesNamespaceNoExport.ts create mode 100644 test/transformation/ts/modulesNamespaceWithMemberExport.ts create mode 100644 test/transformation/ts/modulesNamespaceWithMemberNoExport.ts create mode 100644 test/transformation/ts/modulesVariableExport.ts create mode 100644 test/transformation/ts/modulesVariableNoExport.ts rename test/{integration/testfiles => transformation/ts}/namespace.ts (100%) rename test/{integration/testfiles => transformation/ts}/namespaceNested.ts (100%) rename test/{integration/testfiles => transformation/ts}/namespacePhantom.ts (100%) rename test/{integration/testfiles => transformation/ts}/tryCatch.ts (100%) rename test/{integration/testfiles => transformation/ts}/tryCatchFinally.ts (100%) rename test/{integration/testfiles => transformation/ts}/tryFinally.ts (100%) rename test/{integration/testfiles => transformation/ts}/tupleReturnAssignment.ts (100%) rename test/{integration/testfiles => transformation/ts}/tupleReturnDefinition.ts (100%) rename test/{integration => unit}/assignments.spec.ts (71%) rename test/{integration => unit}/cli.spec.ts (100%) rename test/{integration/lua => unit}/conditionals.spec.ts (99%) rename test/{integration/lua => unit}/curry.spec.ts (95%) rename test/{integration/lua => unit}/error.spec.ts (94%) rename test/{integration/lua => unit}/loops.spec.ts (99%) rename test/{integration/lua => unit}/lualib.spec.ts (99%) rename test/{integration/lua => unit}/math.spec.ts (93%) create mode 100644 test/unit/modules.spec.ts rename test/{integration/lua => unit}/string.spec.ts (99%) diff --git a/test/integration/classConstruction.spec.ts b/test/integration/classConstruction.spec.ts deleted file mode 100644 index 552c1818a..000000000 --- a/test/integration/classConstruction.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Expect, Test, TestCase } from "alsatian"; - -import * as util from "../src/util"; -const fs = require("fs"); - -export class ClassConstruction { - - // Expect the passed lua string to be equal to the file's contents. - private ExpectEqualToFile(lua: string, path: string) { - const expected = fs.readFileSync(path).toString(); - Expect(lua).toBe(expected.trim().split("\r\n").join("\n")); - } - - @Test("ClassEmptyConstructor") - public classEmptyConstructor() { - const lua = util.transpileFile("test/integration/testfiles/classEmptyConstructor.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/classEmptyConstructor.lua"); - } - - @Test("ClassRegularConstructor") - public classRegularConstructor() { - const lua = util.transpileFile("test/integration/testfiles/classRegularConstructor.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/classRegularConstructor.lua"); - } -} diff --git a/test/integration/classInstanceCalls.spec.ts b/test/integration/classInstanceCalls.spec.ts deleted file mode 100644 index a738cab7d..000000000 --- a/test/integration/classInstanceCalls.spec.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Expect, Test, TestCase } from "alsatian"; - -import * as util from "../src/util"; -const fs = require("fs"); - -export class ClassInstanceCallTests { - - // Expect the passed lua string to be equal to the file's contents. - private ExpectEqualToFile(lua: string, path: string) { - const expected = fs.readFileSync(path).toString(); - Expect(lua).toBe(expected.trim().split("\r\n").join("\n")); - } - - @Test("emptyMemberCall1") - public emptyMemberCall1() { - const lua = util.transpileFile("test/integration/testfiles/classInstanceCall1.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/classInstanceCall.lua"); - } - - @Test("emptyMemberCall2") - public emptyMemberCall2() { - const lua = util.transpileFile("test/integration/testfiles/classInstanceCall2.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/classInstanceCall.lua"); - } - - @Test("emptyMemberCall3") - public emptyMemberCall3() { - const lua = util.transpileFile("test/integration/testfiles/classInstanceCall3.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/classInstanceCall.lua"); - } - - @Test("userClassMemberCall") - public userClassMemberCall() { - const lua = util.transpileFile("test/integration/testfiles/classInstanceCall4.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/classInstanceCall4.lua"); - } - - /*@Test("aliasCastCall") - public aliasCastCall() { - const lua = util.transpileFile("test/integration/testfiles/aliasCastCall.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/aliasCall.lua"); - } - - @Test("aliasAsCall") - public aliasAsCall() { - const lua = util.transpileFile("test/integration/testfiles/aliasAsCall.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/aliasCall.lua"); - }*/ -} \ No newline at end of file diff --git a/test/integration/compiler.spec.ts b/test/integration/compiler.spec.ts deleted file mode 100644 index 8d7ea26a8..000000000 --- a/test/integration/compiler.spec.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Expect, Teardown, Test, TestCase } from "alsatian"; -import * as fs from "fs-extra"; -import * as path from "path"; -import { execCommandLine } from "../../src/Compiler"; - -export class CompilerTests { - - @TestCase('tsconfig.default.json', ['typescript_lualib.lua', 'nested/folder/file.lua']) - @TestCase('tsconfig.outDir.json', ['outDir/typescript_lualib.lua', 'outDir/nested/folder/file.lua']) - @TestCase('tsconfig.rootDir.json', ['nested/typescript_lualib.lua', 'nested/folder/file.lua']) - @TestCase('tsconfig.bothDirOptions.json', ['outDir/typescript_lualib.lua', 'outDir/folder/file.lua']) - @Test("Compile options: outDir and rootDir") - public compileProject(tsconfig: string, expectedFiles: string[]) { - const compilerPath = path.resolve('dist/Compiler.js'); - const tsconfigPath = path.resolve('test/integration/project', tsconfig); - - // Compile project - execCommandLine(['-p', tsconfigPath]); - - expectedFiles.forEach(relativePath => { - const absolutePath = path.resolve('test/integration/project', relativePath); - - // Assert - Expect(fs.existsSync(absolutePath)).toBe(true); - - // Delete file - fs.unlink(absolutePath, (error) => { - throw error; - }); - }); - } - - @Teardown - public teardown() { - // Delete outDir folder - fs.removeSync('test/integration/project/outDir'); - } - -} diff --git a/test/integration/decorators.spec.ts b/test/integration/decorators.spec.ts deleted file mode 100644 index bb7fd3978..000000000 --- a/test/integration/decorators.spec.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { Expect, Test, TestCase, IgnoreTest } from "alsatian"; - -import * as util from "../src/util"; -const fs = require("fs"); - -export class DecoratorTests { - - // Expect the passed lua string to be equal to the file's contents. - private ExpectEqualToFile(lua: string, path: string) { - const expected = fs.readFileSync(path).toString(); - Expect(lua).toBe(expected.trim().split("\r\n").join("\n")); - } - - @Test("RegularEnum") - public regularEnum() { - const lua = util.transpileFile("test/integration/testfiles/enum.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/enum.lua"); - } - - @Test("MembersOnlyEnumDecorator") - public membersOnly() { - const lua = util.transpileFile("test/integration/testfiles/enumMembersOnly.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/enumMembersOnly.lua"); - } - - @Test("RegularClassExtend") - public regularClassExtend() { - const lua = util.transpileFile("test/integration/testfiles/class.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/class.lua"); - } - - @Test("PureAbstractClassExtend") - public pureAbstractClassExtend() { - const lua = util.transpileFile("test/integration/testfiles/classPureAbstract.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/classPureAbstract.lua"); - } - - @Test("ExtensionClass") - public extensionClass() { - const lua = util.transpileFile("test/integration/testfiles/classExtension.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/classExtension.lua"); - } - - @Test("PhantomNamespace") - public phantomNamespace() { - const lua = util.transpileFile("test/integration/testfiles/namespacePhantom.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/namespacePhantom.lua"); - } - - @Test("TupleReturnDefinition") - public tupleReturnDefinition() { - const lua = util.transpileFile("test/integration/testfiles/tupleReturnDefinition.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/tupleReturnDefinition.lua"); - } - - @Test("TupleReturnAssignment") - public tupleReturnAssignment() { - const lua = util.transpileFile("test/integration/testfiles/tupleReturnAssignment.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/tupleReturnAssignment.lua"); - } -} diff --git a/test/integration/lua/modules.spec.ts b/test/integration/lua/modules.spec.ts deleted file mode 100644 index 152b5554e..000000000 --- a/test/integration/lua/modules.spec.ts +++ /dev/null @@ -1,159 +0,0 @@ -import { Expect, Test, TestCase } from "alsatian"; -import * as util from "../../src/util" - -const dedent = require('dedent') - -export class LuaModuleTests { - - @TestCase( - `export function publicFunc() {}`, - - `local exports = exports or {} - local function publicFunc() - end - exports.publicFunc = publicFunc - return exports` - ) - @TestCase( - `function publicFunc() {}`, - - `function publicFunc() - end` - ) - @TestCase( - `export const test = "test"`, - - `local exports = exports or {} - local test = "test" - exports.test = test - - return exports` - ) - @TestCase( - `const test = "test"`, - - `local test = "test"` - ) - @TestCase( - `import {TestClass} from "test"`, - - `local test0 = require("test") - local TestClass = test0.TestClass` - ) - @TestCase( - `import * as Test from "test"`, - - `local Test = require("test")` - ) - @TestCase( - `import {TestClass as RenamedClass} from "test"`, - - `local test0 = require("test") - local RenamedClass = test0.TestClass` - ) - @TestCase( - `export class TestClass {}`, - - `local exports = exports or {} - local TestClass = TestClass or {} - exports.TestClass = TestClass - TestClass.__index = TestClass - function TestClass.new(construct, ...) - local instance = setmetatable({}, TestClass) - if construct and TestClass.constructor then TestClass.constructor(instance, ...) end - return instance - end - return exports` - ) - @TestCase( - `export class TestClass { - memberFunc() {} - }`, - - `local exports = exports or {} - local TestClass = TestClass or {} - exports.TestClass = TestClass - TestClass.__index = TestClass - function TestClass.new(construct, ...) - local instance = setmetatable({}, TestClass) - if construct and TestClass.constructor then TestClass.constructor(instance, ...) end - return instance - end - function TestClass.memberFunc(self) - end - return exports` - ) - @TestCase( - `namespace TestSpace {}`, - - `TestSpace = TestSpace or {} - do - end` - ) - @TestCase( - `export namespace TestSpace {}`, - - `local exports = exports or {} - local TestSpace = TestSpace or {} - exports.TestSpace = TestSpace - do - end - return exports` - ) - @TestCase( - `export namespace TestSpace { - function innerFunc() {} - }`, - - `local exports = exports or {} - local TestSpace = TestSpace or {} - exports.TestSpace = TestSpace - do - local function innerFunc() - end - TestSpace.innerFunc = innerFunc - end - return exports` - ) - @TestCase( - `export namespace TestSpace { - export function innerFunc() {} - }`, - - `local exports = exports or {} - local TestSpace = TestSpace or {} - exports.TestSpace = TestSpace - do - local function innerFunc() - end - exports.TestSpace.innerFunc = innerFunc - TestSpace.innerFunc = innerFunc - end - return exports` - ) - @Test("modules") - public modules(inp: string, expected: string) { - // Transpile - let lua = util.transpileString(inp); - - // Assert - // Dont test for correct indention this allows easier test case definition - Expect(dedent(lua)).toBe(dedent(expected)); - } - - @Test("defaultImport") - public defaultImport() { - Expect(() => { - let lua = util.transpileString(`import TestClass from "test"`); - }).toThrowError(Error, "Default Imports are not supported, please use named imports instead!"); - } - - @Test("lualibRequire") - public lualibRequire() { - // Transpile - let lua = util.transpileString(``, {dontRequireLuaLib: false, luaTarget: "JIT"}); - - // Assert - Expect(dedent(lua)).toBe(`require("typescript_lualib")`); - } -} diff --git a/test/integration/namespace.spec.ts b/test/integration/namespace.spec.ts deleted file mode 100644 index a68212c59..000000000 --- a/test/integration/namespace.spec.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Expect, Test, TestCase } from "alsatian"; - -import * as util from "../src/util"; -const fs = require("fs"); - -export class NamespaceTests { - - // Expect the passed lua string to be equal to the file's contents. - private ExpectEqualToFile(lua: string, path: string) { - const expected = fs.readFileSync(path).toString(); - Expect(lua).toBe(expected.trim().split("\r\n").join("\n")); - } - - @Test("RegularNamespace") - public regularNamespace() { - const lua = util.transpileFile("test/integration/testfiles/namespace.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/namespace.lua"); - } - - @Test("NestedNamespace") - public nestedNamespace() { - const lua = util.transpileFile("test/integration/testfiles/namespaceNested.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/namespaceNested.lua"); - } - - - @Test("NamespaceCall") - public namespaceCall() { - const lua = util.transpileFile("test/integration/testfiles/callNamespace.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/callNamespace.lua"); - } -} diff --git a/test/integration/project/nested/folder/file.ts b/test/integration/project/nested/folder/file.ts deleted file mode 100644 index d764cbd99..000000000 --- a/test/integration/project/nested/folder/file.ts +++ /dev/null @@ -1 +0,0 @@ -const test = true; diff --git a/test/integration/project/tsconfig.bothDirOptions.json b/test/integration/project/tsconfig.bothDirOptions.json deleted file mode 100644 index 625a88582..000000000 --- a/test/integration/project/tsconfig.bothDirOptions.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig.default.json", - "compilerOptions": { - "outDir": "../project/outDir", - "rootDir": "../project/nested" - } -} diff --git a/test/integration/project/tsconfig.default.json b/test/integration/project/tsconfig.default.json deleted file mode 100644 index e5a835e99..000000000 --- a/test/integration/project/tsconfig.default.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "luaTarget": "JIT" -} diff --git a/test/integration/project/tsconfig.outDir.json b/test/integration/project/tsconfig.outDir.json deleted file mode 100644 index 81d60baff..000000000 --- a/test/integration/project/tsconfig.outDir.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.default.json", - "compilerOptions": { - "outDir": "../project/outDir" - } -} diff --git a/test/integration/project/tsconfig.rootDir.json b/test/integration/project/tsconfig.rootDir.json deleted file mode 100644 index e57d98355..000000000 --- a/test/integration/project/tsconfig.rootDir.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "./tsconfig.default.json", - "compilerOptions": { - "rootDir": "../project/nested" - } -} diff --git a/test/integration/testfiles/aliasAsCall.ts b/test/integration/testfiles/aliasAsCall.ts deleted file mode 100644 index f29c6cf93..000000000 --- a/test/integration/testfiles/aliasAsCall.ts +++ /dev/null @@ -1,8 +0,0 @@ -declare class ClassA { - myFunc(); -} -declare type MyAlias = ClassA; -declare var x: ClassA; - -x.myFunc(); -(x as MyAlias).myFunc(); \ No newline at end of file diff --git a/test/integration/testfiles/aliasCall.lua b/test/integration/testfiles/aliasCall.lua deleted file mode 100644 index 288bc7f36..000000000 --- a/test/integration/testfiles/aliasCall.lua +++ /dev/null @@ -1,2 +0,0 @@ -ClassA.myFunc(x) -MyAlias.myFunc((x)) \ No newline at end of file diff --git a/test/integration/testfiles/aliasCastCall.ts b/test/integration/testfiles/aliasCastCall.ts deleted file mode 100644 index 10de2ebbc..000000000 --- a/test/integration/testfiles/aliasCastCall.ts +++ /dev/null @@ -1,8 +0,0 @@ -declare class ClassA { - myFunc(); -} -declare type MyAlias = ClassA; -declare var x: ClassA; - -x.myFunc(); -(x).myFunc(); \ No newline at end of file diff --git a/test/integration/tryStatement.spec.ts b/test/integration/tryStatement.spec.ts deleted file mode 100644 index cce0d00d6..000000000 --- a/test/integration/tryStatement.spec.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Expect, Test, TestCase } from "alsatian"; - -import * as util from "../src/util"; -const fs = require("fs"); - -export class NamespaceTests { - - // Expect the passed lua string to be equal to the file's contents. - private ExpectEqualToFile(lua: string, path: string) { - const expected = fs.readFileSync(path).toString(); - Expect(lua).toBe(expected.trim().split("\r\n").join("\n")); - } - - @Test("TryCatch") - public tryCatch() { - const lua = util.transpileFile("test/integration/testfiles/tryCatch.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/tryCatch.lua"); - } - - @Test("TryFinally") - public tryFinally() { - const lua = util.transpileFile("test/integration/testfiles/tryFinally.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/tryFinally.lua"); - } - - @Test("TryCatchFinally") - public tryCatchFinally() { - const lua = util.transpileFile("test/integration/testfiles/tryCatchFinally.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/tryCatchFinally.lua"); - } -} diff --git a/test/transformation/builder.spec.ts b/test/transformation/builder.spec.ts new file mode 100644 index 000000000..5fd2271b7 --- /dev/null +++ b/test/transformation/builder.spec.ts @@ -0,0 +1,52 @@ +import { Expect, Test, TestCases } from "alsatian"; + +import * as util from "../src/util"; + +import * as fs from "fs"; +import * as path from "path"; + +let files: string[][] = []; +let fileContents: {[key: string]: Buffer} = {}; + +let tsPath = path.join(__dirname, "./ts/"); +let luaPath = path.join(__dirname, "./lua/") + +let tsFiles = fs.readdirSync(tsPath); +let luaFiles = fs.readdirSync(luaPath); + +tsFiles.forEach( + (tsFile, i) => { + // ignore non ts files + if (path.extname(tsFile) !== '.ts') { + return; + } + let luaPart = luaFiles.indexOf(tsFile.replace('.ts', '.lua')); + if (luaPart === -1) { + throw new Error("Missing lua counter part for test file: " + tsFile) + } + let luaFile = luaFiles[luaPart]; + let luaFileAbsolute = path.join(luaPath, luaFile); + let tsFileAbsolute = path.join(tsPath, tsFile); + files.push([tsFile, luaFile]); + fileContents[tsFile] = fs.readFileSync(tsFileAbsolute); + fileContents[luaFile] = fs.readFileSync(luaFileAbsolute); + } +); + +function BufferToTestString(b: Buffer): string { + return b.toString().trim().split("\r\n").join("\n") +} + +export class FileTests { + + @TestCases(files) + @Test("Transformation Tests") + public transformationTests(tsFile: string, luaFile:string) { + // Don't check error message because the yargs library messes the message up. + Expect( + BufferToTestString(fileContents[luaFile])) + .toEqual( + util.transpileString(BufferToTestString(fileContents[tsFile]))); + } + +} diff --git a/test/integration/testfiles/assignmentDestructing.lua b/test/transformation/lua/assignmentDestructing.lua similarity index 100% rename from test/integration/testfiles/assignmentDestructing.lua rename to test/transformation/lua/assignmentDestructing.lua diff --git a/test/integration/testfiles/callNamespace.lua b/test/transformation/lua/callNamespace.lua similarity index 100% rename from test/integration/testfiles/callNamespace.lua rename to test/transformation/lua/callNamespace.lua diff --git a/test/integration/testfiles/class.lua b/test/transformation/lua/class.lua similarity index 100% rename from test/integration/testfiles/class.lua rename to test/transformation/lua/class.lua diff --git a/test/integration/testfiles/classEmptyConstructor.lua b/test/transformation/lua/classEmptyConstructor.lua similarity index 100% rename from test/integration/testfiles/classEmptyConstructor.lua rename to test/transformation/lua/classEmptyConstructor.lua diff --git a/test/integration/testfiles/classExtension.lua b/test/transformation/lua/classExtension.lua similarity index 100% rename from test/integration/testfiles/classExtension.lua rename to test/transformation/lua/classExtension.lua diff --git a/test/integration/testfiles/classInstanceCall.lua b/test/transformation/lua/classInstanceCall1.lua similarity index 100% rename from test/integration/testfiles/classInstanceCall.lua rename to test/transformation/lua/classInstanceCall1.lua diff --git a/test/transformation/lua/classInstanceCall2.lua b/test/transformation/lua/classInstanceCall2.lua new file mode 100644 index 000000000..bee2e3a16 --- /dev/null +++ b/test/transformation/lua/classInstanceCall2.lua @@ -0,0 +1 @@ +local x = ClassB.new(true):myFunc() diff --git a/test/transformation/lua/classInstanceCall3.lua b/test/transformation/lua/classInstanceCall3.lua new file mode 100644 index 000000000..bee2e3a16 --- /dev/null +++ b/test/transformation/lua/classInstanceCall3.lua @@ -0,0 +1 @@ +local x = ClassB.new(true):myFunc() diff --git a/test/integration/testfiles/classInstanceCall4.lua b/test/transformation/lua/classInstanceCall4.lua similarity index 100% rename from test/integration/testfiles/classInstanceCall4.lua rename to test/transformation/lua/classInstanceCall4.lua diff --git a/test/integration/testfiles/classPureAbstract.lua b/test/transformation/lua/classPureAbstract.lua similarity index 100% rename from test/integration/testfiles/classPureAbstract.lua rename to test/transformation/lua/classPureAbstract.lua diff --git a/test/integration/testfiles/classRegularConstructor.lua b/test/transformation/lua/classRegularConstructor.lua similarity index 100% rename from test/integration/testfiles/classRegularConstructor.lua rename to test/transformation/lua/classRegularConstructor.lua diff --git a/test/integration/testfiles/enum.lua b/test/transformation/lua/enum.lua similarity index 100% rename from test/integration/testfiles/enum.lua rename to test/transformation/lua/enum.lua diff --git a/test/integration/testfiles/enumMembersOnly.lua b/test/transformation/lua/enumMembersOnly.lua similarity index 100% rename from test/integration/testfiles/enumMembersOnly.lua rename to test/transformation/lua/enumMembersOnly.lua diff --git a/test/transformation/lua/modulesClassExport.lua b/test/transformation/lua/modulesClassExport.lua new file mode 100644 index 000000000..3915d9b49 --- /dev/null +++ b/test/transformation/lua/modulesClassExport.lua @@ -0,0 +1,10 @@ +local exports = exports or {} +local TestClass = TestClass or {} +exports.TestClass = TestClass +TestClass.__index = TestClass +function TestClass.new(construct, ...) + local instance = setmetatable({}, TestClass) + if construct and TestClass.constructor then TestClass.constructor(instance, ...) end + return instance +end +return exports diff --git a/test/transformation/lua/modulesClassWithMemberExport.lua b/test/transformation/lua/modulesClassWithMemberExport.lua new file mode 100644 index 000000000..647e2866e --- /dev/null +++ b/test/transformation/lua/modulesClassWithMemberExport.lua @@ -0,0 +1,12 @@ +local exports = exports or {} +local TestClass = TestClass or {} +exports.TestClass = TestClass +TestClass.__index = TestClass +function TestClass.new(construct, ...) + local instance = setmetatable({}, TestClass) + if construct and TestClass.constructor then TestClass.constructor(instance, ...) end + return instance +end +function TestClass.memberFunc(self) +end +return exports diff --git a/test/transformation/lua/modulesFunctionExport.lua b/test/transformation/lua/modulesFunctionExport.lua new file mode 100644 index 000000000..5b447e5b2 --- /dev/null +++ b/test/transformation/lua/modulesFunctionExport.lua @@ -0,0 +1,5 @@ +local exports = exports or {} +local function publicFunc() +end +exports.publicFunc = publicFunc +return exports diff --git a/test/transformation/lua/modulesFunctionNoExport.lua b/test/transformation/lua/modulesFunctionNoExport.lua new file mode 100644 index 000000000..e0e619215 --- /dev/null +++ b/test/transformation/lua/modulesFunctionNoExport.lua @@ -0,0 +1,2 @@ +function publicFunc() +end diff --git a/test/transformation/lua/modulesImportAll.lua b/test/transformation/lua/modulesImportAll.lua new file mode 100644 index 000000000..6ea71aafb --- /dev/null +++ b/test/transformation/lua/modulesImportAll.lua @@ -0,0 +1 @@ +local Test = require("test") diff --git a/test/transformation/lua/modulesImportNamed.lua b/test/transformation/lua/modulesImportNamed.lua new file mode 100644 index 000000000..6cfee3173 --- /dev/null +++ b/test/transformation/lua/modulesImportNamed.lua @@ -0,0 +1,2 @@ +local test0 = require("test") +local TestClass = test0.TestClass diff --git a/test/transformation/lua/modulesImportRenamed.lua b/test/transformation/lua/modulesImportRenamed.lua new file mode 100644 index 000000000..f72d54e9c --- /dev/null +++ b/test/transformation/lua/modulesImportRenamed.lua @@ -0,0 +1,2 @@ +local test0 = require("test") +local RenamedClass = test0.TestClass diff --git a/test/transformation/lua/modulesNamespaceExport.lua b/test/transformation/lua/modulesNamespaceExport.lua new file mode 100644 index 000000000..0aafe0286 --- /dev/null +++ b/test/transformation/lua/modulesNamespaceExport.lua @@ -0,0 +1,6 @@ +local exports = exports or {} +local TestSpace = TestSpace or {} +exports.TestSpace = TestSpace +do +end +return exports diff --git a/test/transformation/lua/modulesNamespaceNoExport.lua b/test/transformation/lua/modulesNamespaceNoExport.lua new file mode 100644 index 000000000..5c9ff3a1f --- /dev/null +++ b/test/transformation/lua/modulesNamespaceNoExport.lua @@ -0,0 +1,3 @@ +TestSpace = TestSpace or {} +do +end diff --git a/test/transformation/lua/modulesNamespaceWithMemberExport.lua b/test/transformation/lua/modulesNamespaceWithMemberExport.lua new file mode 100644 index 000000000..66b476354 --- /dev/null +++ b/test/transformation/lua/modulesNamespaceWithMemberExport.lua @@ -0,0 +1,10 @@ +local exports = exports or {} +local TestSpace = TestSpace or {} +exports.TestSpace = TestSpace +do + local function innerFunc() + end + exports.TestSpace.innerFunc = innerFunc + TestSpace.innerFunc = innerFunc +end +return exports diff --git a/test/transformation/lua/modulesNamespaceWithMemberNoExport.lua b/test/transformation/lua/modulesNamespaceWithMemberNoExport.lua new file mode 100644 index 000000000..cf17ee4ff --- /dev/null +++ b/test/transformation/lua/modulesNamespaceWithMemberNoExport.lua @@ -0,0 +1,9 @@ +local exports = exports or {} +local TestSpace = TestSpace or {} +exports.TestSpace = TestSpace +do + local function innerFunc() + end + TestSpace.innerFunc = innerFunc +end +return exports diff --git a/test/transformation/lua/modulesVariableExport.lua b/test/transformation/lua/modulesVariableExport.lua new file mode 100644 index 000000000..5e65c46ea --- /dev/null +++ b/test/transformation/lua/modulesVariableExport.lua @@ -0,0 +1,5 @@ +local exports = exports or {} +local test = "test" +exports.test = test + +return exports diff --git a/test/transformation/lua/modulesVariableNoExport.lua b/test/transformation/lua/modulesVariableNoExport.lua new file mode 100644 index 000000000..7aa9c4047 --- /dev/null +++ b/test/transformation/lua/modulesVariableNoExport.lua @@ -0,0 +1 @@ +local test = "test" diff --git a/test/integration/testfiles/namespace.lua b/test/transformation/lua/namespace.lua similarity index 100% rename from test/integration/testfiles/namespace.lua rename to test/transformation/lua/namespace.lua diff --git a/test/integration/testfiles/namespaceNested.lua b/test/transformation/lua/namespaceNested.lua similarity index 100% rename from test/integration/testfiles/namespaceNested.lua rename to test/transformation/lua/namespaceNested.lua diff --git a/test/integration/testfiles/namespacePhantom.lua b/test/transformation/lua/namespacePhantom.lua similarity index 100% rename from test/integration/testfiles/namespacePhantom.lua rename to test/transformation/lua/namespacePhantom.lua diff --git a/test/integration/testfiles/tryCatch.lua b/test/transformation/lua/tryCatch.lua similarity index 100% rename from test/integration/testfiles/tryCatch.lua rename to test/transformation/lua/tryCatch.lua diff --git a/test/integration/testfiles/tryCatchFinally.lua b/test/transformation/lua/tryCatchFinally.lua similarity index 100% rename from test/integration/testfiles/tryCatchFinally.lua rename to test/transformation/lua/tryCatchFinally.lua diff --git a/test/integration/testfiles/tryFinally.lua b/test/transformation/lua/tryFinally.lua similarity index 100% rename from test/integration/testfiles/tryFinally.lua rename to test/transformation/lua/tryFinally.lua diff --git a/test/integration/testfiles/tupleReturnAssignment.lua b/test/transformation/lua/tupleReturnAssignment.lua similarity index 100% rename from test/integration/testfiles/tupleReturnAssignment.lua rename to test/transformation/lua/tupleReturnAssignment.lua diff --git a/test/integration/testfiles/tupleReturnDefinition.lua b/test/transformation/lua/tupleReturnDefinition.lua similarity index 100% rename from test/integration/testfiles/tupleReturnDefinition.lua rename to test/transformation/lua/tupleReturnDefinition.lua diff --git a/test/integration/testfiles/assignmentDestructing.ts b/test/transformation/ts/assignmentDestructing.ts similarity index 100% rename from test/integration/testfiles/assignmentDestructing.ts rename to test/transformation/ts/assignmentDestructing.ts diff --git a/test/integration/testfiles/callNamespace.ts b/test/transformation/ts/callNamespace.ts similarity index 100% rename from test/integration/testfiles/callNamespace.ts rename to test/transformation/ts/callNamespace.ts diff --git a/test/integration/testfiles/class.ts b/test/transformation/ts/class.ts similarity index 100% rename from test/integration/testfiles/class.ts rename to test/transformation/ts/class.ts diff --git a/test/integration/testfiles/classEmptyConstructor.ts b/test/transformation/ts/classEmptyConstructor.ts similarity index 100% rename from test/integration/testfiles/classEmptyConstructor.ts rename to test/transformation/ts/classEmptyConstructor.ts diff --git a/test/integration/testfiles/classExtension.ts b/test/transformation/ts/classExtension.ts similarity index 100% rename from test/integration/testfiles/classExtension.ts rename to test/transformation/ts/classExtension.ts diff --git a/test/integration/testfiles/classInstanceCall1.ts b/test/transformation/ts/classInstanceCall1.ts similarity index 100% rename from test/integration/testfiles/classInstanceCall1.ts rename to test/transformation/ts/classInstanceCall1.ts diff --git a/test/integration/testfiles/classInstanceCall2.ts b/test/transformation/ts/classInstanceCall2.ts similarity index 100% rename from test/integration/testfiles/classInstanceCall2.ts rename to test/transformation/ts/classInstanceCall2.ts diff --git a/test/integration/testfiles/classInstanceCall3.ts b/test/transformation/ts/classInstanceCall3.ts similarity index 100% rename from test/integration/testfiles/classInstanceCall3.ts rename to test/transformation/ts/classInstanceCall3.ts diff --git a/test/integration/testfiles/classInstanceCall4.ts b/test/transformation/ts/classInstanceCall4.ts similarity index 100% rename from test/integration/testfiles/classInstanceCall4.ts rename to test/transformation/ts/classInstanceCall4.ts diff --git a/test/integration/testfiles/classPureAbstract.ts b/test/transformation/ts/classPureAbstract.ts similarity index 100% rename from test/integration/testfiles/classPureAbstract.ts rename to test/transformation/ts/classPureAbstract.ts diff --git a/test/integration/testfiles/classRegularConstructor.ts b/test/transformation/ts/classRegularConstructor.ts similarity index 100% rename from test/integration/testfiles/classRegularConstructor.ts rename to test/transformation/ts/classRegularConstructor.ts diff --git a/test/integration/testfiles/enum.ts b/test/transformation/ts/enum.ts similarity index 100% rename from test/integration/testfiles/enum.ts rename to test/transformation/ts/enum.ts diff --git a/test/integration/testfiles/enumMembersOnly.ts b/test/transformation/ts/enumMembersOnly.ts similarity index 100% rename from test/integration/testfiles/enumMembersOnly.ts rename to test/transformation/ts/enumMembersOnly.ts diff --git a/test/transformation/ts/modulesClassExport.ts b/test/transformation/ts/modulesClassExport.ts new file mode 100644 index 000000000..04ec84b05 --- /dev/null +++ b/test/transformation/ts/modulesClassExport.ts @@ -0,0 +1 @@ +export class TestClass {} diff --git a/test/transformation/ts/modulesClassWithMemberExport.ts b/test/transformation/ts/modulesClassWithMemberExport.ts new file mode 100644 index 000000000..73f226b68 --- /dev/null +++ b/test/transformation/ts/modulesClassWithMemberExport.ts @@ -0,0 +1,3 @@ +export class TestClass { + memberFunc() {} +} diff --git a/test/transformation/ts/modulesFunctionExport.ts b/test/transformation/ts/modulesFunctionExport.ts new file mode 100644 index 000000000..10ea462e7 --- /dev/null +++ b/test/transformation/ts/modulesFunctionExport.ts @@ -0,0 +1 @@ +export function publicFunc() {} diff --git a/test/transformation/ts/modulesFunctionNoExport.ts b/test/transformation/ts/modulesFunctionNoExport.ts new file mode 100644 index 000000000..2388f1489 --- /dev/null +++ b/test/transformation/ts/modulesFunctionNoExport.ts @@ -0,0 +1 @@ +function publicFunc() {} diff --git a/test/transformation/ts/modulesImportAll.ts b/test/transformation/ts/modulesImportAll.ts new file mode 100644 index 000000000..1ffb29e95 --- /dev/null +++ b/test/transformation/ts/modulesImportAll.ts @@ -0,0 +1 @@ +import * as Test from "test" diff --git a/test/transformation/ts/modulesImportNamed.ts b/test/transformation/ts/modulesImportNamed.ts new file mode 100644 index 000000000..14ba1ec8d --- /dev/null +++ b/test/transformation/ts/modulesImportNamed.ts @@ -0,0 +1 @@ +import {TestClass} from "test" diff --git a/test/transformation/ts/modulesImportRenamed.ts b/test/transformation/ts/modulesImportRenamed.ts new file mode 100644 index 000000000..bc19b6b8b --- /dev/null +++ b/test/transformation/ts/modulesImportRenamed.ts @@ -0,0 +1 @@ +import {TestClass as RenamedClass} from "test" diff --git a/test/transformation/ts/modulesNamespaceExport.ts b/test/transformation/ts/modulesNamespaceExport.ts new file mode 100644 index 000000000..b2ac45fb4 --- /dev/null +++ b/test/transformation/ts/modulesNamespaceExport.ts @@ -0,0 +1 @@ +export namespace TestSpace {} diff --git a/test/transformation/ts/modulesNamespaceNoExport.ts b/test/transformation/ts/modulesNamespaceNoExport.ts new file mode 100644 index 000000000..3bf6cf214 --- /dev/null +++ b/test/transformation/ts/modulesNamespaceNoExport.ts @@ -0,0 +1 @@ +namespace TestSpace {} diff --git a/test/transformation/ts/modulesNamespaceWithMemberExport.ts b/test/transformation/ts/modulesNamespaceWithMemberExport.ts new file mode 100644 index 000000000..fa5eeb49c --- /dev/null +++ b/test/transformation/ts/modulesNamespaceWithMemberExport.ts @@ -0,0 +1,3 @@ +export namespace TestSpace { + export function innerFunc() {} +} diff --git a/test/transformation/ts/modulesNamespaceWithMemberNoExport.ts b/test/transformation/ts/modulesNamespaceWithMemberNoExport.ts new file mode 100644 index 000000000..b44c2aa71 --- /dev/null +++ b/test/transformation/ts/modulesNamespaceWithMemberNoExport.ts @@ -0,0 +1,3 @@ +export namespace TestSpace { + function innerFunc() {} +} diff --git a/test/transformation/ts/modulesVariableExport.ts b/test/transformation/ts/modulesVariableExport.ts new file mode 100644 index 000000000..13f4d5b45 --- /dev/null +++ b/test/transformation/ts/modulesVariableExport.ts @@ -0,0 +1 @@ +export const test = "test" diff --git a/test/transformation/ts/modulesVariableNoExport.ts b/test/transformation/ts/modulesVariableNoExport.ts new file mode 100644 index 000000000..858f3dd7c --- /dev/null +++ b/test/transformation/ts/modulesVariableNoExport.ts @@ -0,0 +1 @@ +const test = "test" diff --git a/test/integration/testfiles/namespace.ts b/test/transformation/ts/namespace.ts similarity index 100% rename from test/integration/testfiles/namespace.ts rename to test/transformation/ts/namespace.ts diff --git a/test/integration/testfiles/namespaceNested.ts b/test/transformation/ts/namespaceNested.ts similarity index 100% rename from test/integration/testfiles/namespaceNested.ts rename to test/transformation/ts/namespaceNested.ts diff --git a/test/integration/testfiles/namespacePhantom.ts b/test/transformation/ts/namespacePhantom.ts similarity index 100% rename from test/integration/testfiles/namespacePhantom.ts rename to test/transformation/ts/namespacePhantom.ts diff --git a/test/integration/testfiles/tryCatch.ts b/test/transformation/ts/tryCatch.ts similarity index 100% rename from test/integration/testfiles/tryCatch.ts rename to test/transformation/ts/tryCatch.ts diff --git a/test/integration/testfiles/tryCatchFinally.ts b/test/transformation/ts/tryCatchFinally.ts similarity index 100% rename from test/integration/testfiles/tryCatchFinally.ts rename to test/transformation/ts/tryCatchFinally.ts diff --git a/test/integration/testfiles/tryFinally.ts b/test/transformation/ts/tryFinally.ts similarity index 100% rename from test/integration/testfiles/tryFinally.ts rename to test/transformation/ts/tryFinally.ts diff --git a/test/integration/testfiles/tupleReturnAssignment.ts b/test/transformation/ts/tupleReturnAssignment.ts similarity index 100% rename from test/integration/testfiles/tupleReturnAssignment.ts rename to test/transformation/ts/tupleReturnAssignment.ts diff --git a/test/integration/testfiles/tupleReturnDefinition.ts b/test/transformation/ts/tupleReturnDefinition.ts similarity index 100% rename from test/integration/testfiles/tupleReturnDefinition.ts rename to test/transformation/ts/tupleReturnDefinition.ts diff --git a/test/tsconfig.json b/test/tsconfig.json index f67bcf592..48e2e8cb3 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -4,7 +4,6 @@ "sourceMap": true }, "exclude": [ - "integration/testfiles/*", - "integration/project/*" + "transformation/ts/*", ] } diff --git a/test/integration/assignments.spec.ts b/test/unit/assignments.spec.ts similarity index 71% rename from test/integration/assignments.spec.ts rename to test/unit/assignments.spec.ts index b8b6bcba5..79ace3686 100644 --- a/test/integration/assignments.spec.ts +++ b/test/unit/assignments.spec.ts @@ -5,12 +5,6 @@ const fs = require("fs"); export class AssignmentTests { - // Expect the passed lua string to be equal to the file's contents. - private ExpectEqualToFile(lua: string, path: string) { - const expected = fs.readFileSync(path).toString(); - Expect(lua).toBe(expected.trim().split("\r\n").join("\n")); - } - @TestCase(`"abc"`, `"abc"`) @TestCase("3", "3") @TestCase("[1,2,3]", "{1,2,3}") @@ -46,10 +40,4 @@ export class AssignmentTests { var lua = util.transpileString(`var myvar = ${inp};`) Expect(lua).toBe(`local myvar = ${out}`); } - - @Test("Destructing assignment") - public destructingAssignment() { - const lua = util.transpileFile("test/integration/testfiles/assignmentDestructing.ts"); - this.ExpectEqualToFile(lua, "test/integration/testfiles/assignmentDestructing.lua"); - } } diff --git a/test/integration/cli.spec.ts b/test/unit/cli.spec.ts similarity index 100% rename from test/integration/cli.spec.ts rename to test/unit/cli.spec.ts diff --git a/test/integration/lua/conditionals.spec.ts b/test/unit/conditionals.spec.ts similarity index 99% rename from test/integration/lua/conditionals.spec.ts rename to test/unit/conditionals.spec.ts index 21feb0304..e7839f0f3 100644 --- a/test/integration/lua/conditionals.spec.ts +++ b/test/unit/conditionals.spec.ts @@ -1,5 +1,5 @@ import { Expect, Test, TestCase, FocusTest } from "alsatian"; -import * as util from "../../src/util" +import * as util from "../src/util" export class LuaConditionalsTests { diff --git a/test/integration/lua/curry.spec.ts b/test/unit/curry.spec.ts similarity index 95% rename from test/integration/lua/curry.spec.ts rename to test/unit/curry.spec.ts index e023f104b..7ede40d32 100644 --- a/test/integration/lua/curry.spec.ts +++ b/test/unit/curry.spec.ts @@ -1,5 +1,5 @@ import { Expect, Test, TestCase } from "alsatian"; -import * as util from "../../src/util" +import * as util from "../src/util" export class LuaCurryTests { diff --git a/test/integration/lua/error.spec.ts b/test/unit/error.spec.ts similarity index 94% rename from test/integration/lua/error.spec.ts rename to test/unit/error.spec.ts index 4d03bca53..ed2e66f91 100644 --- a/test/integration/lua/error.spec.ts +++ b/test/unit/error.spec.ts @@ -1,5 +1,5 @@ import { Expect, Test, TestCase } from "alsatian"; -import * as util from "../../src/util" +import * as util from "../src/util" export class LuaErrorTests { diff --git a/test/unit/expressions.spec.ts b/test/unit/expressions.spec.ts index a176ec9b0..6d266d7cb 100644 --- a/test/unit/expressions.spec.ts +++ b/test/unit/expressions.spec.ts @@ -1,8 +1,6 @@ import { Expect, Test, TestCase } from "alsatian"; import * as ts from "typescript"; -import { LuaTranspiler, TranspileError } from "../../dist/Transpiler"; - import * as util from "../src/util"; export class ExpressionTests { diff --git a/test/integration/lua/loops.spec.ts b/test/unit/loops.spec.ts similarity index 99% rename from test/integration/lua/loops.spec.ts rename to test/unit/loops.spec.ts index 68ff788e9..57763dd33 100644 --- a/test/integration/lua/loops.spec.ts +++ b/test/unit/loops.spec.ts @@ -1,5 +1,5 @@ import { Expect, Test, TestCase, FocusTest } from "alsatian"; -import * as util from "../../src/util" +import * as util from "../src/util" const deepEqual = require('deep-equal') diff --git a/test/integration/lua/lualib.spec.ts b/test/unit/lualib.spec.ts similarity index 99% rename from test/integration/lua/lualib.spec.ts rename to test/unit/lualib.spec.ts index 111e396c6..d1a1f94ab 100644 --- a/test/integration/lua/lualib.spec.ts +++ b/test/unit/lualib.spec.ts @@ -1,5 +1,5 @@ import { Expect, Test, TestCase } from "alsatian"; -import * as util from "../../src/util" +import * as util from "../src/util" export class LuaLibArrayTests { diff --git a/test/integration/lua/math.spec.ts b/test/unit/math.spec.ts similarity index 93% rename from test/integration/lua/math.spec.ts rename to test/unit/math.spec.ts index 0ea01d9a4..cdab19b27 100644 --- a/test/integration/lua/math.spec.ts +++ b/test/unit/math.spec.ts @@ -1,5 +1,5 @@ import { Expect, Test, TestCase, IgnoreTest } from "alsatian"; -import * as util from "../../src/util" +import * as util from "../src/util" export class MathTests { diff --git a/test/unit/modules.spec.ts b/test/unit/modules.spec.ts new file mode 100644 index 000000000..3a6b6f167 --- /dev/null +++ b/test/unit/modules.spec.ts @@ -0,0 +1,23 @@ +import { Expect, Test, TestCase } from "alsatian"; +import * as util from "../src/util" + +const dedent = require('dedent') + +export class LuaModuleTests { + + @Test("defaultImport") + public defaultImport() { + Expect(() => { + let lua = util.transpileString(`import TestClass from "test"`); + }).toThrowError(Error, "Default Imports are not supported, please use named imports instead!"); + } + + @Test("lualibRequire") + public lualibRequire() { + // Transpile + let lua = util.transpileString(``, {dontRequireLuaLib: false, luaTarget: "JIT"}); + + // Assert + Expect(dedent(lua)).toBe(`require("typescript_lualib")`); + } +} diff --git a/test/integration/lua/string.spec.ts b/test/unit/string.spec.ts similarity index 99% rename from test/integration/lua/string.spec.ts rename to test/unit/string.spec.ts index 4299437da..755182da8 100644 --- a/test/integration/lua/string.spec.ts +++ b/test/unit/string.spec.ts @@ -1,5 +1,5 @@ import { Expect, Test, TestCase, IgnoreTest } from "alsatian"; -import * as util from "../../src/util" +import * as util from "../src/util" export class StringTests { From f254d55dafb7f7d0653659da241ec4786e431fbc Mon Sep 17 00:00:00 2001 From: lolleko Date: Mon, 19 Mar 2018 00:51:52 +0100 Subject: [PATCH 2/3] Added CLI Test cases --- test/unit/cli.spec.ts | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/test/unit/cli.spec.ts b/test/unit/cli.spec.ts index 68577d97a..94c806505 100644 --- a/test/unit/cli.spec.ts +++ b/test/unit/cli.spec.ts @@ -11,10 +11,10 @@ export class CLITests { @TestCase("dontRequireLuaLib", false) @TestCase("rootDir", process.cwd()) @TestCase("outDir", process.cwd()) - public defaultOptions(option: string, expected: string) { + public defaultOptions(option: any, expected: any) { let parsedCommandLine = parseCommandLine([]); - Expect(parsedCommandLine.options[option]).toBe(expected); + Expect(expected).toBe(parsedCommandLine.options[option]); } @Test("InvalidLuaTarget") @@ -22,4 +22,34 @@ export class CLITests { // Don't check error message because the yargs library messes the message up. Expect(() => parseCommandLine(['--luaTarget', '42'])).toThrow(); } + + @Test("InvalidArgument") + public invalidArgument() { + // Don't check error message because the yargs library messes the message up. + Expect(() => parseCommandLine(['--invalidTarget', 'test'])).toThrow(); + } + + @Test("outDir") + public outDir() { + let parsedCommandLine = parseCommandLine(['--outDir', './test']); + + Expect(parsedCommandLine.options['outDir']).toBe('./test'); + } + + @Test("rootDir") + public rootDir() { + let parsedCommandLine = parseCommandLine(['--rootDir', './test']); + + Expect(parsedCommandLine.options['rootDir']).toBe('./test'); + Expect(parsedCommandLine.options['outDir']).toBe('./test'); + } + + @Test("outDirAndRooDir") + public outDirAndRooDir() { + let parsedCommandLine = parseCommandLine(['--outDir', './testOut', '--rootDir', './testRoot']); + + Expect(parsedCommandLine.options['outDir']).toBe('./testOut'); + Expect(parsedCommandLine.options['rootDir']).toBe('./testRoot'); + } + } From fd8ac0f4cdef3541d2b1802ee87c1c0a8d50203a Mon Sep 17 00:00:00 2001 From: lolleko Date: Wed, 21 Mar 2018 18:07:20 +0100 Subject: [PATCH 3/3] Renamed translation tests & removed comment --- test/{transformation => translation}/builder.spec.ts | 1 - .../lua/assignmentDestructing.lua | 0 test/{transformation => translation}/lua/callNamespace.lua | 0 test/{transformation => translation}/lua/class.lua | 0 .../lua/classEmptyConstructor.lua | 0 test/{transformation => translation}/lua/classExtension.lua | 0 test/{transformation => translation}/lua/classInstanceCall1.lua | 0 test/{transformation => translation}/lua/classInstanceCall2.lua | 0 test/{transformation => translation}/lua/classInstanceCall3.lua | 0 test/{transformation => translation}/lua/classInstanceCall4.lua | 0 test/{transformation => translation}/lua/classPureAbstract.lua | 0 .../lua/classRegularConstructor.lua | 0 test/{transformation => translation}/lua/enum.lua | 0 test/{transformation => translation}/lua/enumMembersOnly.lua | 0 test/{transformation => translation}/lua/modulesClassExport.lua | 0 .../lua/modulesClassWithMemberExport.lua | 0 .../lua/modulesFunctionExport.lua | 0 .../lua/modulesFunctionNoExport.lua | 0 test/{transformation => translation}/lua/modulesImportAll.lua | 0 test/{transformation => translation}/lua/modulesImportNamed.lua | 0 .../lua/modulesImportRenamed.lua | 0 .../lua/modulesNamespaceExport.lua | 0 .../lua/modulesNamespaceNoExport.lua | 0 .../lua/modulesNamespaceWithMemberExport.lua | 0 .../lua/modulesNamespaceWithMemberNoExport.lua | 0 .../lua/modulesVariableExport.lua | 0 .../lua/modulesVariableNoExport.lua | 0 test/{transformation => translation}/lua/namespace.lua | 0 test/{transformation => translation}/lua/namespaceNested.lua | 0 test/{transformation => translation}/lua/namespacePhantom.lua | 0 test/{transformation => translation}/lua/tryCatch.lua | 0 test/{transformation => translation}/lua/tryCatchFinally.lua | 0 test/{transformation => translation}/lua/tryFinally.lua | 0 .../lua/tupleReturnAssignment.lua | 0 .../lua/tupleReturnDefinition.lua | 0 .../{transformation => translation}/ts/assignmentDestructing.ts | 0 test/{transformation => translation}/ts/callNamespace.ts | 0 test/{transformation => translation}/ts/class.ts | 0 .../{transformation => translation}/ts/classEmptyConstructor.ts | 0 test/{transformation => translation}/ts/classExtension.ts | 0 test/{transformation => translation}/ts/classInstanceCall1.ts | 0 test/{transformation => translation}/ts/classInstanceCall2.ts | 0 test/{transformation => translation}/ts/classInstanceCall3.ts | 0 test/{transformation => translation}/ts/classInstanceCall4.ts | 0 test/{transformation => translation}/ts/classPureAbstract.ts | 0 .../ts/classRegularConstructor.ts | 0 test/{transformation => translation}/ts/enum.ts | 0 test/{transformation => translation}/ts/enumMembersOnly.ts | 0 test/{transformation => translation}/ts/modulesClassExport.ts | 0 .../ts/modulesClassWithMemberExport.ts | 0 .../{transformation => translation}/ts/modulesFunctionExport.ts | 0 .../ts/modulesFunctionNoExport.ts | 0 test/{transformation => translation}/ts/modulesImportAll.ts | 0 test/{transformation => translation}/ts/modulesImportNamed.ts | 0 test/{transformation => translation}/ts/modulesImportRenamed.ts | 0 .../ts/modulesNamespaceExport.ts | 0 .../ts/modulesNamespaceNoExport.ts | 0 .../ts/modulesNamespaceWithMemberExport.ts | 0 .../ts/modulesNamespaceWithMemberNoExport.ts | 0 .../{transformation => translation}/ts/modulesVariableExport.ts | 0 .../ts/modulesVariableNoExport.ts | 0 test/{transformation => translation}/ts/namespace.ts | 0 test/{transformation => translation}/ts/namespaceNested.ts | 0 test/{transformation => translation}/ts/namespacePhantom.ts | 0 test/{transformation => translation}/ts/tryCatch.ts | 0 test/{transformation => translation}/ts/tryCatchFinally.ts | 0 test/{transformation => translation}/ts/tryFinally.ts | 0 .../{transformation => translation}/ts/tupleReturnAssignment.ts | 0 .../{transformation => translation}/ts/tupleReturnDefinition.ts | 0 test/tsconfig.json | 2 +- 70 files changed, 1 insertion(+), 2 deletions(-) rename test/{transformation => translation}/builder.spec.ts (94%) rename test/{transformation => translation}/lua/assignmentDestructing.lua (100%) rename test/{transformation => translation}/lua/callNamespace.lua (100%) rename test/{transformation => translation}/lua/class.lua (100%) rename test/{transformation => translation}/lua/classEmptyConstructor.lua (100%) rename test/{transformation => translation}/lua/classExtension.lua (100%) rename test/{transformation => translation}/lua/classInstanceCall1.lua (100%) rename test/{transformation => translation}/lua/classInstanceCall2.lua (100%) rename test/{transformation => translation}/lua/classInstanceCall3.lua (100%) rename test/{transformation => translation}/lua/classInstanceCall4.lua (100%) rename test/{transformation => translation}/lua/classPureAbstract.lua (100%) rename test/{transformation => translation}/lua/classRegularConstructor.lua (100%) rename test/{transformation => translation}/lua/enum.lua (100%) rename test/{transformation => translation}/lua/enumMembersOnly.lua (100%) rename test/{transformation => translation}/lua/modulesClassExport.lua (100%) rename test/{transformation => translation}/lua/modulesClassWithMemberExport.lua (100%) rename test/{transformation => translation}/lua/modulesFunctionExport.lua (100%) rename test/{transformation => translation}/lua/modulesFunctionNoExport.lua (100%) rename test/{transformation => translation}/lua/modulesImportAll.lua (100%) rename test/{transformation => translation}/lua/modulesImportNamed.lua (100%) rename test/{transformation => translation}/lua/modulesImportRenamed.lua (100%) rename test/{transformation => translation}/lua/modulesNamespaceExport.lua (100%) rename test/{transformation => translation}/lua/modulesNamespaceNoExport.lua (100%) rename test/{transformation => translation}/lua/modulesNamespaceWithMemberExport.lua (100%) rename test/{transformation => translation}/lua/modulesNamespaceWithMemberNoExport.lua (100%) rename test/{transformation => translation}/lua/modulesVariableExport.lua (100%) rename test/{transformation => translation}/lua/modulesVariableNoExport.lua (100%) rename test/{transformation => translation}/lua/namespace.lua (100%) rename test/{transformation => translation}/lua/namespaceNested.lua (100%) rename test/{transformation => translation}/lua/namespacePhantom.lua (100%) rename test/{transformation => translation}/lua/tryCatch.lua (100%) rename test/{transformation => translation}/lua/tryCatchFinally.lua (100%) rename test/{transformation => translation}/lua/tryFinally.lua (100%) rename test/{transformation => translation}/lua/tupleReturnAssignment.lua (100%) rename test/{transformation => translation}/lua/tupleReturnDefinition.lua (100%) rename test/{transformation => translation}/ts/assignmentDestructing.ts (100%) rename test/{transformation => translation}/ts/callNamespace.ts (100%) rename test/{transformation => translation}/ts/class.ts (100%) rename test/{transformation => translation}/ts/classEmptyConstructor.ts (100%) rename test/{transformation => translation}/ts/classExtension.ts (100%) rename test/{transformation => translation}/ts/classInstanceCall1.ts (100%) rename test/{transformation => translation}/ts/classInstanceCall2.ts (100%) rename test/{transformation => translation}/ts/classInstanceCall3.ts (100%) rename test/{transformation => translation}/ts/classInstanceCall4.ts (100%) rename test/{transformation => translation}/ts/classPureAbstract.ts (100%) rename test/{transformation => translation}/ts/classRegularConstructor.ts (100%) rename test/{transformation => translation}/ts/enum.ts (100%) rename test/{transformation => translation}/ts/enumMembersOnly.ts (100%) rename test/{transformation => translation}/ts/modulesClassExport.ts (100%) rename test/{transformation => translation}/ts/modulesClassWithMemberExport.ts (100%) rename test/{transformation => translation}/ts/modulesFunctionExport.ts (100%) rename test/{transformation => translation}/ts/modulesFunctionNoExport.ts (100%) rename test/{transformation => translation}/ts/modulesImportAll.ts (100%) rename test/{transformation => translation}/ts/modulesImportNamed.ts (100%) rename test/{transformation => translation}/ts/modulesImportRenamed.ts (100%) rename test/{transformation => translation}/ts/modulesNamespaceExport.ts (100%) rename test/{transformation => translation}/ts/modulesNamespaceNoExport.ts (100%) rename test/{transformation => translation}/ts/modulesNamespaceWithMemberExport.ts (100%) rename test/{transformation => translation}/ts/modulesNamespaceWithMemberNoExport.ts (100%) rename test/{transformation => translation}/ts/modulesVariableExport.ts (100%) rename test/{transformation => translation}/ts/modulesVariableNoExport.ts (100%) rename test/{transformation => translation}/ts/namespace.ts (100%) rename test/{transformation => translation}/ts/namespaceNested.ts (100%) rename test/{transformation => translation}/ts/namespacePhantom.ts (100%) rename test/{transformation => translation}/ts/tryCatch.ts (100%) rename test/{transformation => translation}/ts/tryCatchFinally.ts (100%) rename test/{transformation => translation}/ts/tryFinally.ts (100%) rename test/{transformation => translation}/ts/tupleReturnAssignment.ts (100%) rename test/{transformation => translation}/ts/tupleReturnDefinition.ts (100%) diff --git a/test/transformation/builder.spec.ts b/test/translation/builder.spec.ts similarity index 94% rename from test/transformation/builder.spec.ts rename to test/translation/builder.spec.ts index 5fd2271b7..266c7809b 100644 --- a/test/transformation/builder.spec.ts +++ b/test/translation/builder.spec.ts @@ -42,7 +42,6 @@ export class FileTests { @TestCases(files) @Test("Transformation Tests") public transformationTests(tsFile: string, luaFile:string) { - // Don't check error message because the yargs library messes the message up. Expect( BufferToTestString(fileContents[luaFile])) .toEqual( diff --git a/test/transformation/lua/assignmentDestructing.lua b/test/translation/lua/assignmentDestructing.lua similarity index 100% rename from test/transformation/lua/assignmentDestructing.lua rename to test/translation/lua/assignmentDestructing.lua diff --git a/test/transformation/lua/callNamespace.lua b/test/translation/lua/callNamespace.lua similarity index 100% rename from test/transformation/lua/callNamespace.lua rename to test/translation/lua/callNamespace.lua diff --git a/test/transformation/lua/class.lua b/test/translation/lua/class.lua similarity index 100% rename from test/transformation/lua/class.lua rename to test/translation/lua/class.lua diff --git a/test/transformation/lua/classEmptyConstructor.lua b/test/translation/lua/classEmptyConstructor.lua similarity index 100% rename from test/transformation/lua/classEmptyConstructor.lua rename to test/translation/lua/classEmptyConstructor.lua diff --git a/test/transformation/lua/classExtension.lua b/test/translation/lua/classExtension.lua similarity index 100% rename from test/transformation/lua/classExtension.lua rename to test/translation/lua/classExtension.lua diff --git a/test/transformation/lua/classInstanceCall1.lua b/test/translation/lua/classInstanceCall1.lua similarity index 100% rename from test/transformation/lua/classInstanceCall1.lua rename to test/translation/lua/classInstanceCall1.lua diff --git a/test/transformation/lua/classInstanceCall2.lua b/test/translation/lua/classInstanceCall2.lua similarity index 100% rename from test/transformation/lua/classInstanceCall2.lua rename to test/translation/lua/classInstanceCall2.lua diff --git a/test/transformation/lua/classInstanceCall3.lua b/test/translation/lua/classInstanceCall3.lua similarity index 100% rename from test/transformation/lua/classInstanceCall3.lua rename to test/translation/lua/classInstanceCall3.lua diff --git a/test/transformation/lua/classInstanceCall4.lua b/test/translation/lua/classInstanceCall4.lua similarity index 100% rename from test/transformation/lua/classInstanceCall4.lua rename to test/translation/lua/classInstanceCall4.lua diff --git a/test/transformation/lua/classPureAbstract.lua b/test/translation/lua/classPureAbstract.lua similarity index 100% rename from test/transformation/lua/classPureAbstract.lua rename to test/translation/lua/classPureAbstract.lua diff --git a/test/transformation/lua/classRegularConstructor.lua b/test/translation/lua/classRegularConstructor.lua similarity index 100% rename from test/transformation/lua/classRegularConstructor.lua rename to test/translation/lua/classRegularConstructor.lua diff --git a/test/transformation/lua/enum.lua b/test/translation/lua/enum.lua similarity index 100% rename from test/transformation/lua/enum.lua rename to test/translation/lua/enum.lua diff --git a/test/transformation/lua/enumMembersOnly.lua b/test/translation/lua/enumMembersOnly.lua similarity index 100% rename from test/transformation/lua/enumMembersOnly.lua rename to test/translation/lua/enumMembersOnly.lua diff --git a/test/transformation/lua/modulesClassExport.lua b/test/translation/lua/modulesClassExport.lua similarity index 100% rename from test/transformation/lua/modulesClassExport.lua rename to test/translation/lua/modulesClassExport.lua diff --git a/test/transformation/lua/modulesClassWithMemberExport.lua b/test/translation/lua/modulesClassWithMemberExport.lua similarity index 100% rename from test/transformation/lua/modulesClassWithMemberExport.lua rename to test/translation/lua/modulesClassWithMemberExport.lua diff --git a/test/transformation/lua/modulesFunctionExport.lua b/test/translation/lua/modulesFunctionExport.lua similarity index 100% rename from test/transformation/lua/modulesFunctionExport.lua rename to test/translation/lua/modulesFunctionExport.lua diff --git a/test/transformation/lua/modulesFunctionNoExport.lua b/test/translation/lua/modulesFunctionNoExport.lua similarity index 100% rename from test/transformation/lua/modulesFunctionNoExport.lua rename to test/translation/lua/modulesFunctionNoExport.lua diff --git a/test/transformation/lua/modulesImportAll.lua b/test/translation/lua/modulesImportAll.lua similarity index 100% rename from test/transformation/lua/modulesImportAll.lua rename to test/translation/lua/modulesImportAll.lua diff --git a/test/transformation/lua/modulesImportNamed.lua b/test/translation/lua/modulesImportNamed.lua similarity index 100% rename from test/transformation/lua/modulesImportNamed.lua rename to test/translation/lua/modulesImportNamed.lua diff --git a/test/transformation/lua/modulesImportRenamed.lua b/test/translation/lua/modulesImportRenamed.lua similarity index 100% rename from test/transformation/lua/modulesImportRenamed.lua rename to test/translation/lua/modulesImportRenamed.lua diff --git a/test/transformation/lua/modulesNamespaceExport.lua b/test/translation/lua/modulesNamespaceExport.lua similarity index 100% rename from test/transformation/lua/modulesNamespaceExport.lua rename to test/translation/lua/modulesNamespaceExport.lua diff --git a/test/transformation/lua/modulesNamespaceNoExport.lua b/test/translation/lua/modulesNamespaceNoExport.lua similarity index 100% rename from test/transformation/lua/modulesNamespaceNoExport.lua rename to test/translation/lua/modulesNamespaceNoExport.lua diff --git a/test/transformation/lua/modulesNamespaceWithMemberExport.lua b/test/translation/lua/modulesNamespaceWithMemberExport.lua similarity index 100% rename from test/transformation/lua/modulesNamespaceWithMemberExport.lua rename to test/translation/lua/modulesNamespaceWithMemberExport.lua diff --git a/test/transformation/lua/modulesNamespaceWithMemberNoExport.lua b/test/translation/lua/modulesNamespaceWithMemberNoExport.lua similarity index 100% rename from test/transformation/lua/modulesNamespaceWithMemberNoExport.lua rename to test/translation/lua/modulesNamespaceWithMemberNoExport.lua diff --git a/test/transformation/lua/modulesVariableExport.lua b/test/translation/lua/modulesVariableExport.lua similarity index 100% rename from test/transformation/lua/modulesVariableExport.lua rename to test/translation/lua/modulesVariableExport.lua diff --git a/test/transformation/lua/modulesVariableNoExport.lua b/test/translation/lua/modulesVariableNoExport.lua similarity index 100% rename from test/transformation/lua/modulesVariableNoExport.lua rename to test/translation/lua/modulesVariableNoExport.lua diff --git a/test/transformation/lua/namespace.lua b/test/translation/lua/namespace.lua similarity index 100% rename from test/transformation/lua/namespace.lua rename to test/translation/lua/namespace.lua diff --git a/test/transformation/lua/namespaceNested.lua b/test/translation/lua/namespaceNested.lua similarity index 100% rename from test/transformation/lua/namespaceNested.lua rename to test/translation/lua/namespaceNested.lua diff --git a/test/transformation/lua/namespacePhantom.lua b/test/translation/lua/namespacePhantom.lua similarity index 100% rename from test/transformation/lua/namespacePhantom.lua rename to test/translation/lua/namespacePhantom.lua diff --git a/test/transformation/lua/tryCatch.lua b/test/translation/lua/tryCatch.lua similarity index 100% rename from test/transformation/lua/tryCatch.lua rename to test/translation/lua/tryCatch.lua diff --git a/test/transformation/lua/tryCatchFinally.lua b/test/translation/lua/tryCatchFinally.lua similarity index 100% rename from test/transformation/lua/tryCatchFinally.lua rename to test/translation/lua/tryCatchFinally.lua diff --git a/test/transformation/lua/tryFinally.lua b/test/translation/lua/tryFinally.lua similarity index 100% rename from test/transformation/lua/tryFinally.lua rename to test/translation/lua/tryFinally.lua diff --git a/test/transformation/lua/tupleReturnAssignment.lua b/test/translation/lua/tupleReturnAssignment.lua similarity index 100% rename from test/transformation/lua/tupleReturnAssignment.lua rename to test/translation/lua/tupleReturnAssignment.lua diff --git a/test/transformation/lua/tupleReturnDefinition.lua b/test/translation/lua/tupleReturnDefinition.lua similarity index 100% rename from test/transformation/lua/tupleReturnDefinition.lua rename to test/translation/lua/tupleReturnDefinition.lua diff --git a/test/transformation/ts/assignmentDestructing.ts b/test/translation/ts/assignmentDestructing.ts similarity index 100% rename from test/transformation/ts/assignmentDestructing.ts rename to test/translation/ts/assignmentDestructing.ts diff --git a/test/transformation/ts/callNamespace.ts b/test/translation/ts/callNamespace.ts similarity index 100% rename from test/transformation/ts/callNamespace.ts rename to test/translation/ts/callNamespace.ts diff --git a/test/transformation/ts/class.ts b/test/translation/ts/class.ts similarity index 100% rename from test/transformation/ts/class.ts rename to test/translation/ts/class.ts diff --git a/test/transformation/ts/classEmptyConstructor.ts b/test/translation/ts/classEmptyConstructor.ts similarity index 100% rename from test/transformation/ts/classEmptyConstructor.ts rename to test/translation/ts/classEmptyConstructor.ts diff --git a/test/transformation/ts/classExtension.ts b/test/translation/ts/classExtension.ts similarity index 100% rename from test/transformation/ts/classExtension.ts rename to test/translation/ts/classExtension.ts diff --git a/test/transformation/ts/classInstanceCall1.ts b/test/translation/ts/classInstanceCall1.ts similarity index 100% rename from test/transformation/ts/classInstanceCall1.ts rename to test/translation/ts/classInstanceCall1.ts diff --git a/test/transformation/ts/classInstanceCall2.ts b/test/translation/ts/classInstanceCall2.ts similarity index 100% rename from test/transformation/ts/classInstanceCall2.ts rename to test/translation/ts/classInstanceCall2.ts diff --git a/test/transformation/ts/classInstanceCall3.ts b/test/translation/ts/classInstanceCall3.ts similarity index 100% rename from test/transformation/ts/classInstanceCall3.ts rename to test/translation/ts/classInstanceCall3.ts diff --git a/test/transformation/ts/classInstanceCall4.ts b/test/translation/ts/classInstanceCall4.ts similarity index 100% rename from test/transformation/ts/classInstanceCall4.ts rename to test/translation/ts/classInstanceCall4.ts diff --git a/test/transformation/ts/classPureAbstract.ts b/test/translation/ts/classPureAbstract.ts similarity index 100% rename from test/transformation/ts/classPureAbstract.ts rename to test/translation/ts/classPureAbstract.ts diff --git a/test/transformation/ts/classRegularConstructor.ts b/test/translation/ts/classRegularConstructor.ts similarity index 100% rename from test/transformation/ts/classRegularConstructor.ts rename to test/translation/ts/classRegularConstructor.ts diff --git a/test/transformation/ts/enum.ts b/test/translation/ts/enum.ts similarity index 100% rename from test/transformation/ts/enum.ts rename to test/translation/ts/enum.ts diff --git a/test/transformation/ts/enumMembersOnly.ts b/test/translation/ts/enumMembersOnly.ts similarity index 100% rename from test/transformation/ts/enumMembersOnly.ts rename to test/translation/ts/enumMembersOnly.ts diff --git a/test/transformation/ts/modulesClassExport.ts b/test/translation/ts/modulesClassExport.ts similarity index 100% rename from test/transformation/ts/modulesClassExport.ts rename to test/translation/ts/modulesClassExport.ts diff --git a/test/transformation/ts/modulesClassWithMemberExport.ts b/test/translation/ts/modulesClassWithMemberExport.ts similarity index 100% rename from test/transformation/ts/modulesClassWithMemberExport.ts rename to test/translation/ts/modulesClassWithMemberExport.ts diff --git a/test/transformation/ts/modulesFunctionExport.ts b/test/translation/ts/modulesFunctionExport.ts similarity index 100% rename from test/transformation/ts/modulesFunctionExport.ts rename to test/translation/ts/modulesFunctionExport.ts diff --git a/test/transformation/ts/modulesFunctionNoExport.ts b/test/translation/ts/modulesFunctionNoExport.ts similarity index 100% rename from test/transformation/ts/modulesFunctionNoExport.ts rename to test/translation/ts/modulesFunctionNoExport.ts diff --git a/test/transformation/ts/modulesImportAll.ts b/test/translation/ts/modulesImportAll.ts similarity index 100% rename from test/transformation/ts/modulesImportAll.ts rename to test/translation/ts/modulesImportAll.ts diff --git a/test/transformation/ts/modulesImportNamed.ts b/test/translation/ts/modulesImportNamed.ts similarity index 100% rename from test/transformation/ts/modulesImportNamed.ts rename to test/translation/ts/modulesImportNamed.ts diff --git a/test/transformation/ts/modulesImportRenamed.ts b/test/translation/ts/modulesImportRenamed.ts similarity index 100% rename from test/transformation/ts/modulesImportRenamed.ts rename to test/translation/ts/modulesImportRenamed.ts diff --git a/test/transformation/ts/modulesNamespaceExport.ts b/test/translation/ts/modulesNamespaceExport.ts similarity index 100% rename from test/transformation/ts/modulesNamespaceExport.ts rename to test/translation/ts/modulesNamespaceExport.ts diff --git a/test/transformation/ts/modulesNamespaceNoExport.ts b/test/translation/ts/modulesNamespaceNoExport.ts similarity index 100% rename from test/transformation/ts/modulesNamespaceNoExport.ts rename to test/translation/ts/modulesNamespaceNoExport.ts diff --git a/test/transformation/ts/modulesNamespaceWithMemberExport.ts b/test/translation/ts/modulesNamespaceWithMemberExport.ts similarity index 100% rename from test/transformation/ts/modulesNamespaceWithMemberExport.ts rename to test/translation/ts/modulesNamespaceWithMemberExport.ts diff --git a/test/transformation/ts/modulesNamespaceWithMemberNoExport.ts b/test/translation/ts/modulesNamespaceWithMemberNoExport.ts similarity index 100% rename from test/transformation/ts/modulesNamespaceWithMemberNoExport.ts rename to test/translation/ts/modulesNamespaceWithMemberNoExport.ts diff --git a/test/transformation/ts/modulesVariableExport.ts b/test/translation/ts/modulesVariableExport.ts similarity index 100% rename from test/transformation/ts/modulesVariableExport.ts rename to test/translation/ts/modulesVariableExport.ts diff --git a/test/transformation/ts/modulesVariableNoExport.ts b/test/translation/ts/modulesVariableNoExport.ts similarity index 100% rename from test/transformation/ts/modulesVariableNoExport.ts rename to test/translation/ts/modulesVariableNoExport.ts diff --git a/test/transformation/ts/namespace.ts b/test/translation/ts/namespace.ts similarity index 100% rename from test/transformation/ts/namespace.ts rename to test/translation/ts/namespace.ts diff --git a/test/transformation/ts/namespaceNested.ts b/test/translation/ts/namespaceNested.ts similarity index 100% rename from test/transformation/ts/namespaceNested.ts rename to test/translation/ts/namespaceNested.ts diff --git a/test/transformation/ts/namespacePhantom.ts b/test/translation/ts/namespacePhantom.ts similarity index 100% rename from test/transformation/ts/namespacePhantom.ts rename to test/translation/ts/namespacePhantom.ts diff --git a/test/transformation/ts/tryCatch.ts b/test/translation/ts/tryCatch.ts similarity index 100% rename from test/transformation/ts/tryCatch.ts rename to test/translation/ts/tryCatch.ts diff --git a/test/transformation/ts/tryCatchFinally.ts b/test/translation/ts/tryCatchFinally.ts similarity index 100% rename from test/transformation/ts/tryCatchFinally.ts rename to test/translation/ts/tryCatchFinally.ts diff --git a/test/transformation/ts/tryFinally.ts b/test/translation/ts/tryFinally.ts similarity index 100% rename from test/transformation/ts/tryFinally.ts rename to test/translation/ts/tryFinally.ts diff --git a/test/transformation/ts/tupleReturnAssignment.ts b/test/translation/ts/tupleReturnAssignment.ts similarity index 100% rename from test/transformation/ts/tupleReturnAssignment.ts rename to test/translation/ts/tupleReturnAssignment.ts diff --git a/test/transformation/ts/tupleReturnDefinition.ts b/test/translation/ts/tupleReturnDefinition.ts similarity index 100% rename from test/transformation/ts/tupleReturnDefinition.ts rename to test/translation/ts/tupleReturnDefinition.ts diff --git a/test/tsconfig.json b/test/tsconfig.json index 48e2e8cb3..bc298b3cd 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -4,6 +4,6 @@ "sourceMap": true }, "exclude": [ - "transformation/ts/*", + "translation/ts/*", ] }