diff --git a/examples/game.ink b/examples/game.ink index 85a4b98..4bde4a5 100644 --- a/examples/game.ink +++ b/examples/game.ink @@ -1,14 +1,25 @@ -=== start === +=== back_in_london === -"What that's?" my master asked. -* "I am somewhat tired[."]," I repeated. - "Really," he responded. "How deleterious." -* "Nothing, Monsieur!"[] I replied. - "Very good, then." - -> finale -* "I said, this journey is appalling[."] and I want no more of it." - "Ah," he replied, not unkindly. "I see you are feeling frustrated. Tomorrow, things will improve." -* [Leave] -> finale +We arrived into London at 9.45pm exactly. -=== finale === -Bye +* "There is not a moment to lose!"[] I declared. + -> hurry_outside + +* "Monsieur, let us savour this moment!"[] I declared. + My master clouted me firmly around the head and dragged me out of the door. + -> dragged_outside + +* [We hurried home] -> hurry_outside + + +=== hurry_outside === +We hurried home to Savile Row -> as_fast_as_we_could + + +=== dragged_outside === +He insisted that we hurried home to Savile Row +-> as_fast_as_we_could + + +=== as_fast_as_we_could === +<> as fast as we could. diff --git a/test.lua b/test.lua index c86b518..71221b9 100644 --- a/test.lua +++ b/test.lua @@ -23,6 +23,7 @@ function testChoices() doTest('choices') end function testNest() doTest('nested') end function testNest2() doTest('nested2') end function testKnot() doTest('knot') end +function testBranching() doTest('branching') end diff --git a/test/branching.lua b/test/branching.lua new file mode 100644 index 0000000..7dfe2a9 --- /dev/null +++ b/test/branching.lua @@ -0,0 +1,71 @@ +return { +ink=[[ +=== back_in_london === + +We arrived into London at 9.45pm exactly. + +* "There is not a moment to lose!"[] I declared. + -> hurry_outside + +* "Monsieur, let us savour this moment!"[] I declared. + My master clouted me firmly around the head and dragged me out of the door. + -> dragged_outside + +* [We hurried home] -> hurry_outside + + +=== hurry_outside === +We hurried home to Savile Row -> as_fast_as_we_could + + +=== dragged_outside === +He insisted that we hurried home to Savile Row +-> as_fast_as_we_could + + +=== as_fast_as_we_could === +<> as fast as we could. +]], +expected= { + { + "knot", + "back_in_london", + {"para", "We arrived into London at 9.45pm exactly."}, + { + "choice", + { + "option", + '"There is not a moment to lose!"', + "", + " I declared.", + {"divert", "hurry_outside"} + }, + { + "option", + '"Monsieur, let us savour this moment!"', + "", + " I declared.", + { + "para", + "My master clouted me firmly around the head and dragged me out of the door." + }, + {"divert", "dragged_outside"} + }, + {"option", "", "We hurried home", " ", {"divert", "hurry_outside"}} + } + }, + { + "knot", + "hurry_outside", + {"para", "We hurried home to Savile Row "}, + {"divert", "as_fast_as_we_could"} + }, + { + "knot", + "dragged_outside", + {"para", "He insisted that we hurried home to Savile Row"}, + {"divert", "as_fast_as_we_could"} + }, + {"knot", "as_fast_as_we_could", "glue", {"para", "as fast as we could."}} +} +}