11import { Expect , Test , TestCase } from "alsatian" ;
22import { TranspileError } from "../../src/TranspileError" ;
3- import { LuaTarget } from "../../src/CompilerOptions" ;
3+ import { LuaTarget , LuaLibImportKind } from "../../src/CompilerOptions" ;
44
55import * as ts from "typescript" ;
66import * as util from "../src/util" ;
@@ -100,7 +100,7 @@ export class ExpressionTests {
100100 @Test ( "Bitop [5.1]" )
101101 public bitOperatorOverride51 ( input : string , lua : string ) : void {
102102 // Bit operations not supported in 5.1, expect an exception
103- Expect ( ( ) => util . transpileString ( input , { luaTarget : LuaTarget . Lua51 , luaLibImport : "none" } ) )
103+ Expect ( ( ) => util . transpileString ( input , { luaTarget : LuaTarget . Lua51 , luaLibImport : LuaLibImportKind . None } ) )
104104 . toThrow ( ) ;
105105 }
106106
@@ -119,7 +119,8 @@ export class ExpressionTests {
119119 @TestCase ( "a>>>=b" , "a = bit.arshift(a, b);" )
120120 @Test ( "Bitop [JIT]" )
121121 public bitOperatorOverrideJIT ( input : string , lua : string ) : void {
122- Expect ( util . transpileString ( input , { luaTarget : LuaTarget . LuaJIT , luaLibImport : "none" } ) ) . toBe ( lua ) ;
122+ const options = { luaTarget : LuaTarget . LuaJIT , luaLibImport : LuaLibImportKind . None } ;
123+ Expect ( util . transpileString ( input , options ) ) . toBe ( lua ) ;
123124 }
124125
125126 @TestCase ( "~a" , "bit32.bnot(a);" )
@@ -137,7 +138,8 @@ export class ExpressionTests {
137138 @TestCase ( "a>>>=b" , "a = bit32.arshift(a, b);" )
138139 @Test ( "Bitop [5.2]" )
139140 public bitOperatorOverride52 ( input : string , lua : string ) : void {
140- Expect ( util . transpileString ( input , { luaTarget : LuaTarget . Lua52 , luaLibImport : "none" } ) ) . toBe ( lua ) ;
141+ const options = { luaTarget : LuaTarget . Lua52 , luaLibImport : LuaLibImportKind . None } ;
142+ Expect ( util . transpileString ( input , options ) ) . toBe ( lua ) ;
141143 }
142144
143145 @TestCase ( "~a" , "~a;" )
@@ -153,14 +155,15 @@ export class ExpressionTests {
153155 @TestCase ( "a>>=b" , "a = a >> b;" )
154156 @Test ( "Bitop [5.3]" )
155157 public bitOperatorOverride53 ( input : string , lua : string ) : void {
156- Expect ( util . transpileString ( input , { luaTarget : LuaTarget . Lua53 , luaLibImport : "none" } ) ) . toBe ( lua ) ;
158+ const options = { luaTarget : LuaTarget . Lua53 , luaLibImport : LuaLibImportKind . None } ;
159+ Expect ( util . transpileString ( input , options ) ) . toBe ( lua ) ;
157160 }
158161
159162 @TestCase ( "a>>>b" )
160163 @TestCase ( "a>>>=b" )
161164 @Test ( "Unsupported bitop 5.3" )
162165 public bitOperatorOverride53Unsupported ( input : string ) : void {
163- Expect ( ( ) => util . transpileString ( input , { luaTarget : LuaTarget . Lua53 , luaLibImport : "none" } ) )
166+ Expect ( ( ) => util . transpileString ( input , { luaTarget : LuaTarget . Lua53 , luaLibImport : LuaLibImportKind . None } ) )
164167 . toThrowError ( TranspileError , "Bitwise >>> operator is/are not supported for target Lua 5.3." ) ;
165168 }
166169
0 commit comments