-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: replace quickjs engine with quickjs-ng
feat: update lua engine to 5.4.7 feat: add some test scripts fix: fix a bug in command overload
- Loading branch information
Showing
8 changed files
with
78 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export function loggerTest(player) { | ||
if (player) { | ||
logger.setPlayer(player) | ||
} | ||
logger.setFile("logs/LegacyScriptEngine/ScriptTests.log"); | ||
logger.log("This is a log message"); | ||
logger.warn("This is a warning message"); | ||
logger.error("This is an error message"); | ||
logger.debug("This is a debug message"); | ||
logger.info("This is an info message"); | ||
logger.fatal("This is a fetal message"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {RegisterEvents, events, triggeredEvents} from './plugins/LSETests/EventTests.js'; | ||
import {loggerTest} from './plugins/LSETests/ScriptTests.js'; | ||
|
||
RegisterEvents(); | ||
|
||
mc.listen('onServerStarted', () => { | ||
let cmd = mc.newCommand('lsetests', "LegacyScriptEngine tests", PermType.Console); | ||
cmd.setEnum('testOption', ['logger', 'events']); | ||
cmd.mandatory('testOption', ParamType.Enum, 'testOption'); | ||
cmd.optional('player', ParamType.Player); | ||
cmd.overload('testOption', 'player'); | ||
cmd.setCallback((cmd, origin, output, results) => { | ||
switch (results.testOption) { | ||
case 'logger': | ||
loggerTest(results.player); | ||
break; | ||
case 'events': | ||
const | ||
notTriggeredEvents = events.filter(event => !triggeredEvents.has(event)); | ||
logger.info(`Events not triggered: ${notTriggeredEvents.join(', ')}`); | ||
break; | ||
default: | ||
logger.error(`Invalid test option ${results.testOption}`); | ||
break; | ||
} | ||
}); | ||
}) | ||
|
||
|
4 changes: 2 additions & 2 deletions
4
src/tests/EventTests/manifest.json → src/tests/LSETests/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters