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 @@ -233,7 +233,7 @@ export abstract class LuaTranspiler {
233233 }
234234
235235 // Inline lualib features
236- if ( this . options . luaLibImport === LuaLibImportKind . Inline ) {
236+ if ( this . options . luaLibImport === LuaLibImportKind . Inline && this . luaLibFeatureSet . size > 0 ) {
237237 result += "\n" + "-- Lua Library Imports\n" ;
238238 for ( const feature of this . luaLibFeatureSet ) {
239239 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
@@ -63,4 +54,16 @@ export class LuaModuleTests {
6354
6455 Expect ( result ) . toBe ( 3 ) ;
6556 }
57+
58+ @TestCase ( LuaLibImportKind . Inline )
59+ @TestCase ( LuaLibImportKind . None )
60+ @TestCase ( LuaLibImportKind . Require )
61+ @Test ( "LuaLib no uses? No code" )
62+ public lualibNoUsesNoCode ( impKind : LuaLibImportKind ) : void {
63+ // Transpile
64+ const lua = util . transpileString ( `` , { luaLibImport : impKind } ) ;
65+
66+ // Assert
67+ Expect ( lua ) . toBe ( `` ) ;
68+ }
6669}
You can’t perform that action at this time.
0 commit comments