File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed
Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,7 @@ export abstract class LuaTranspiler {
213213 }
214214
215215 // Inline lualib features
216- if ( this . options . luaLibImport === LuaLibImportKind . Inline ) {
216+ if ( this . options . luaLibImport === LuaLibImportKind . Inline && this . luaLibFeatureSet . size > 0 ) {
217217 result += "\n" + "-- Lua Library Imports\n" ;
218218 for ( const feature of this . luaLibFeatureSet ) {
219219 const featureFile = path . resolve ( __dirname , `../dist/lualib/${ feature } .lua` ) ;
Original file line number Diff line number Diff line change @@ -23,15 +23,6 @@ export class LuaModuleTests {
2323 Expect ( lua . startsWith ( `require("lualib_bundle")` ) ) ;
2424 }
2525
26- @Test ( "lualibRequireNoUses" )
27- public lualibRequireNoUses ( ) : void {
28- // Transpile
29- const lua = util . transpileString ( `` , { luaLibImport : LuaLibImportKind . Require , luaTarget : LuaTarget . LuaJIT } ) ;
30-
31- // Assert
32- Expect ( lua ) . toBe ( `` ) ;
33- }
34-
3526 @Test ( "lualibRequireAlways" )
3627 public lualibRequireAlways ( ) : void {
3728 // Transpile
@@ -49,4 +40,16 @@ export class LuaModuleTests {
4940
5041 Expect ( result ) . toBe ( 3 ) ;
5142 }
43+
44+ @TestCase ( LuaLibImportKind . Inline )
45+ @TestCase ( LuaLibImportKind . None )
46+ @TestCase ( LuaLibImportKind . Require )
47+ @Test ( "LuaLib no uses? No code" )
48+ public lualibNoUsesNoCode ( impKind : LuaLibImportKind ) : void {
49+ // Transpile
50+ const lua = util . transpileString ( `` , { luaLibImport : impKind } ) ;
51+
52+ // Assert
53+ Expect ( lua ) . toBe ( `` ) ;
54+ }
5255}
You can’t perform that action at this time.
0 commit comments