You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.2 KiB
36 lines
1.2 KiB
3 years ago
|
import {parse} from "./NomScript.peggy";
|
||
|
import {scriptFile} from "./ScriptFile";
|
||
|
import {versionStatement} from "./TopLevelStatement";
|
||
|
import {battlerAttribute, BattlerAttributeType, battlerDeclaration} from "./BattlerStatement";
|
||
|
import {numberValue} from "./ScriptValue";
|
||
|
|
||
|
test("integration test", () => {
|
||
|
const result = parse(`
|
||
|
script version 1
|
||
|
|
||
|
battler reya
|
||
|
health 90
|
||
|
confidence 2000
|
||
|
stamina 50
|
||
|
end battler
|
||
|
|
||
|
battler kun_chan
|
||
|
health 500
|
||
|
confidence 1000
|
||
|
stamina 200
|
||
|
end battler
|
||
|
`, {grammarSource: "testData", start: "ScriptFile"})
|
||
|
expect(result).toEqual(scriptFile([
|
||
|
versionStatement(1),
|
||
|
battlerDeclaration("reya", [
|
||
|
battlerAttribute(BattlerAttributeType.HEALTH, numberValue(90)),
|
||
|
battlerAttribute(BattlerAttributeType.CONFIDENCE, numberValue(2000)),
|
||
|
battlerAttribute(BattlerAttributeType.STAMINA, numberValue(50))
|
||
|
]),
|
||
|
battlerDeclaration("kun_chan", [
|
||
|
battlerAttribute(BattlerAttributeType.HEALTH, numberValue(500)),
|
||
|
battlerAttribute(BattlerAttributeType.CONFIDENCE, numberValue(1000)),
|
||
|
battlerAttribute(BattlerAttributeType.STAMINA, numberValue(200))
|
||
|
]),
|
||
|
]))
|
||
|
})
|