-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTests.cs
2200 lines (1742 loc) · 48.2 KB
/
Tests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using NUnit.Framework;
using Ink;
using Ink.Runtime;
using System.Collections.Generic;
namespace Tests
{
public enum TestMode
{
Normal,
JsonRoundTrip
}
[TestFixture(TestMode.Normal)]
[TestFixture(TestMode.JsonRoundTrip)]
internal class Tests
{
public Tests(TestMode mode)
{
_mode = mode;
}
TestMode _mode;
bool _testingErrors;
List<string> _errorMessages = new List<string>();
List<string> _warningMessages = new List<string>();
bool HadError(string matchStr = null)
{
return HadErrorOrWarning (matchStr, _errorMessages);
}
bool HadWarning(string matchStr = null)
{
return HadErrorOrWarning (matchStr, _warningMessages);
}
bool HadErrorOrWarning(string matchStr, List<string> list)
{
if (matchStr == null)
return list.Count > 0;
foreach (var str in list) {
if (str.Contains (matchStr))
return true;
}
return false;
}
void TestErrorHandler(string message, ErrorType errorType)
{
if (_testingErrors) {
if( errorType == ErrorType.Error )
_errorMessages.Add (message);
else
_warningMessages.Add (message);
} else
Assert.Fail(message);
}
// Helper compile function
protected Story CompileString(string str, bool countAllVisits=false, bool testingErrors=false)
{
_testingErrors = testingErrors;
_errorMessages.Clear ();
_warningMessages.Clear ();
InkParser parser = new InkParser(str, null, null, TestErrorHandler);
var parsedStory = parser.Parse();
parsedStory.countAllVisits = countAllVisits;
Story story = parsedStory.ExportRuntime (TestErrorHandler);
Assert.AreNotEqual (null, story);
// Convert to json and back again
if (_mode == TestMode.JsonRoundTrip) {
var jsonStr = story.ToJsonString (indented:true);
story = new Story (jsonStr);
}
return story;
}
protected Ink.Parsed.Story CompileStringWithoutRuntime(string str, bool testingErrors=false)
{
_testingErrors = testingErrors;
_errorMessages.Clear ();
_warningMessages.Clear ();
InkParser parser = new InkParser(str, null, null, TestErrorHandler);
var parsedStory = parser.Parse();
Assert.IsFalse (parsedStory.hadError);
parsedStory.ExportRuntime (TestErrorHandler);
return parsedStory;
}
[Test ()]
public void TestHelloWorld()
{
Story story = CompileString ("Hello world");
Assert.AreEqual ("Hello world\n", story.Continue());
}
[Test ()]
public void TestWhitespace()
{
var storyStr =
@"
=== firstKnot
Hello!
-> anotherKnot
=== anotherKnot
World.
-> END
";
Story story = CompileString (storyStr);
Assert.AreEqual ("Hello!\nWorld.\n", story.ContinueMaximally());
}
[Test ()]
public void TestCallStackEvaluation()
{
var storyStr =
@"
=== eight
{ six() + two() }
-> END
=== function six
~ return four() + two()
=== function four
~ return two() + two()
=== function two
~ return 2
";
Story story = CompileString (storyStr);
Assert.AreEqual ("8\n", story.Continue());
}
[Test ()]
public void TestWeaveOptions()
{
var storyStr =
@"
=== test
* Hello[.], world.
-> END
";
Story story = CompileString (storyStr);
story.Continue ();
Assert.AreEqual ("Hello.", story.currentChoices[0].text);
story.ChooseChoiceIndex (0);
Assert.AreEqual ("Hello, world.\n", story.Continue());
}
[Test ()]
public void TestConditionalChoices()
{
var storyStr =
@"
* { true } { false } not displayed
* { true } { true }
{ true and true } one
* { false } not displayed
* (name) { true } two
* { true }
{ true }
three
* { true }
four
";
Story story = CompileString (storyStr);
story.ContinueMaximally ();
Assert.AreEqual (4, story.currentChoices.Count);
Assert.AreEqual ("one", story.currentChoices[0].text);
Assert.AreEqual ("two", story.currentChoices[1].text);
Assert.AreEqual ("three", story.currentChoices[2].text);
Assert.AreEqual ("four", story.currentChoices[3].text);
}
[Test ()]
public void TestNonTextInChoiceInnerContent()
{
var storyStr =
@"
== knot
* option text[]. {true: Conditional bit.} -> next
-> DONE
== next
Next.
-> DONE
";
Story story = CompileString (storyStr);
story.Continue ();
story.ChooseChoiceIndex (0);
Assert.AreEqual ("option text. Conditional bit.\n", story.Continue());
Assert.AreEqual ("Next.\n", story.Continue());
}
[Test ()]
public void TestDivertInConditional()
{
var storyStr =
@"
=== intro
= top
{ main: -> done }
-> END
= main
-> top
= done
-> END
";
Story story = CompileString (storyStr);
Assert.AreEqual ("", story.ContinueMaximally());
}
[Test ()]
public void TestInclude()
{
var storyStr =
@"
INCLUDE test_included_file.ink
INCLUDE test_included_file2.ink
This is the main file.
";
Story story = CompileString (storyStr);
Assert.AreEqual ("This is include 1.\nThis is include 2.\nThis is the main file.\n", story.ContinueMaximally());
}
[Test ()]
public void TestNestedInclude()
{
var storyStr =
@"
INCLUDE test_included_file3.ink
This is the main file
-> knot_in_2
";
Story story = CompileString (storyStr);
Assert.AreEqual ("The value of a variable in test file 2 is 5.\nThis is the main file\nThe value when accessed from knot_in_2 is 5.\n", story.ContinueMaximally());
}
[Test ()]
public void TestConditionals()
{
var storyStr =
@"
{false:not true|true}
{
- 4 > 5: not true
- 5 > 4: true
}
{ 2*2 > 3:
- true
- not true
}
{
- 1 > 3: not true
- { 2+2 == 4:
- true
- not true
}
}
{ 2*3:
- 1+7: not true
- 9: not true
- 1+1+1+3: true
- 9-3: also true but not printed
}
{ true:
great
right?
}
";
Story story = CompileString (storyStr);
Assert.AreEqual ("true\ntrue\ntrue\ntrue\ntrue\ngreat\nright?\n", story.ContinueMaximally());
}
public void TestElseBranches()
{
var storyStr =
@"
VAR x = 3
{
- x == 1: one
- x == 2: two
- else: other
}
{
- x == 1: one
- x == 2: two
- other
}
{ x == 4:
- The main clause
- else: other
}
{ x == 4:
The main clause
- else:
other
}
";
Story story = CompileString (storyStr);
Assert.AreEqual ("other\nother\nother\nother\n", story.currentText);
}
[Test ()]
public void TestConditionalChoiceInWeave()
{
var storyStr =
@"
== test ==
- start
{
- true: * [go to a stitch] -> a_stitch
}
- gather shouldn't be seen
-> END
= a_stitch
result
-> END
";
Story story = CompileString (storyStr);
// Extra newline is because there's a choice object sandwiched there,
// so it can't be absorbed :-/
Assert.AreEqual ("start\n", story.Continue());
Assert.AreEqual (1, story.currentChoices.Count);
story.ChooseChoiceIndex (0);
Assert.AreEqual ("result\n", story.Continue());
}
[Test ()]
public void TestHasReadOnChoice()
{
var storyStr =
@"
* { not test } visible choice
* { test } visible choice
== test ==
-> END
";
Story story = CompileString (storyStr);
story.ContinueMaximally ();
Assert.AreEqual (1, story.currentChoices.Count);
Assert.AreEqual ("visible choice", story.currentChoices[0].text);
}
[Test ()]
public void TestConditionalChoiceInWeave2()
{
var storyStr =
@"
- first gather
* option 1
* option 2
- the main gather
{false:
* unreachable option
}
- unrechable gather
";
Story story = CompileString (storyStr);
Assert.AreEqual ("first gather\n", story.Continue());
Assert.AreEqual (2, story.currentChoices.Count);
story.ChooseChoiceIndex (0);
Assert.AreEqual ("option 1\nthe main gather\n", story.ContinueMaximally());
Assert.AreEqual (0, story.currentChoices.Count);
}
[Test ()]
public void TestVariableDeclarationInConditional()
{
var storyStr =
@"
VAR x = 0
{true:
- ~ x = 5
}
{x}
";
Story story = CompileString (storyStr);
// Extra newline is because there's a choice object sandwiched there,
// so it can't be absorbed :-/
Assert.AreEqual ("5\n", story.Continue());
}
[Test ()]
public void TestDivertToWeavePoints()
{
var storyStr =
@"
-> knot.stitch.gather
== knot ==
= stitch
- hello
* (choice) test
choice content
- (gather)
gather
{stopping:
- -> knot.stitch.choice
- second time round
}
-> END
";
Story story = CompileString (storyStr);
Assert.AreEqual ("gather\ntest\nchoice content\ngather\nsecond time round\n", story.ContinueMaximally());
}
[Test ()]
public void TestWeaveGathers()
{
var storyStr =
@"
-
* one
* * two
- - three
* four
- - five
- six
";
Story story = CompileString (storyStr);
story.ContinueMaximally ();
Assert.AreEqual (2, story.currentChoices.Count);
Assert.AreEqual ("one", story.currentChoices[0].text);
Assert.AreEqual ("four", story.currentChoices[1].text);
story.ChooseChoiceIndex (0);
story.ContinueMaximally ();
Assert.AreEqual (1, story.currentChoices.Count);
Assert.AreEqual ("two", story.currentChoices[0].text);
story.ChooseChoiceIndex (0);
Assert.AreEqual ("two\nthree\nsix\n", story.ContinueMaximally());
}
[Test ()]
public void TestGatherAtFlowEnd()
{
// The final "->" doesn't have anywhere to go, so it should
// happily just go to the end of the flow.
var storyStr = "- nothing ->";
Story story = CompileString (storyStr);
// Hrm: terminating space is a little bit silly
// (it's because the divert arrow forces a little bit of
// whitespace in case you're diverting straight into another line)
Assert.AreEqual ("nothing ", story.ContinueMaximally());
}
[Test ()]
public void TestChoiceWithBracketsOnly()
{
var storyStr = "* [Option]\n Text";
Story story = CompileString (storyStr);
story.Continue ();
Assert.AreEqual (1, story.currentChoices.Count);
Assert.AreEqual ("Option", story.currentChoices[0].text);
story.ChooseChoiceIndex (0);
Assert.AreEqual ("Text\n", story.Continue());
}
[Test ()]
public void TestGatherChoiceSameLine()
{
var storyStr = "- * hello\n- * world";
Story story = CompileString (storyStr);
story.Continue ();
Assert.AreEqual ("hello", story.currentChoices [0].text);
story.ChooseChoiceIndex (0);
story.Continue ();
Assert.AreEqual ("world", story.currentChoices [0].text);
}
[Test ()]
public void TestSimpleGlue()
{
var storyStr = "Some <> \ncontent<> with glue.\n";
Story story = CompileString (storyStr);
Assert.AreEqual ("Some content with glue.\n", story.Continue());
}
[Test ()]
public void TestEscapeCharacter()
{
var storyStr = @"{true:this is a '\|' character|this isn't}";
Story story = CompileString (storyStr);
Assert.AreEqual ("this is a '|' character\n", story.ContinueMaximally());
}
[Test ()]
public void TestCompareDivertTargets()
{
var storyStr = @"
VAR to_one = -> one
VAR to_two = -> two
{to_one == to_two:same knot|different knot}
{to_one == to_one:same knot|different knot}
{to_two == to_two:same knot|different knot}
{ -> one == -> two:same knot|different knot}
{ -> one == to_one:same knot|different knot}
{ to_one == -> one:same knot|different knot}
== one
One
-> DONE
=== two
Two
-> DONE";
Story story = CompileString (storyStr);
Assert.AreEqual ("different knot\nsame knot\nsame knot\ndifferent knot\nsame knot\nsame knot\n", story.ContinueMaximally());
}
[Test ()]
public void TestFactorialRecursive()
{
var storyStr = @"
{ factorial(5) }
== function factorial(n) ==
{ n == 1:
~ return 1
- else:
~ return (n * factorial(n-1))
}
";
Story story = CompileString (storyStr);
Assert.AreEqual ("120\n", story.ContinueMaximally());
}
[Test ()]
public void TestNestedPassByReference()
{
var storyStr = @"
VAR globalVal = 5
{globalVal}
~ squaresquare(globalVal)
{globalVal}
== function squaresquare(ref x) ==
{square(x)} {square(x)}
~ return
== function square(ref x) ==
~ x = x * x
~ return
";
Story story = CompileString (storyStr);
// Bloody whitespace
Assert.AreEqual ("5\n \n625\n", story.ContinueMaximally());
}
[Test ()]
public void TestFactorialByReference()
{
var storyStr = @"
VAR result = 0
~ factorialByRef(result, 5)
{ result }
== function factorialByRef(ref r, n) ==
{ r == 0:
~ r = 1
}
{ n > 1:
~ r = r * n
~ factorialByRef(r, n-1)
}
~ return
";
Story story = CompileString (storyStr);
Assert.AreEqual ("120\n", story.ContinueMaximally());
}
[Test ()]
public void TestVariableSwapRecurse()
{
var storyStr = @"
~ f(1, 1)
== function f(x, y) ==
{ x == 1 and y == 1:
~ x = 2
~ f(y, x)
- else:
{x} {y}
}
~ return
";
Story story = CompileString (storyStr);
Assert.AreEqual ("1 2\n", story.ContinueMaximally());
}
[Test ()]
public void TestEmpty()
{
Story story = CompileString (@"");
Assert.AreEqual (string.Empty, story.currentText);
}
[Test ()]
public void TestIncrement()
{
Story story = CompileString (@"
VAR x = 5
~ x++
{x}
~ x--
{x}
");
Assert.AreEqual ("6\n5\n", story.ContinueMaximally());
}
[Test ()]
public void TestReadCountDotSeparatedPath()
{
Story story = CompileString (@"
-> hi ->
-> hi ->
-> hi ->
{ hi.stitch_to_count }
== hi ==
= stitch_to_count
hi
->->
");
Assert.AreEqual ("hi\nhi\nhi\n3\n", story.ContinueMaximally());
}
[Test ()]
public void TestChoiceCount()
{
Story story = CompileString (@"
* one -> end
* two -> end
{ CHOICE_COUNT() }
= end
-> END
");
Assert.AreEqual ("2\n", story.Continue());
}
[Test ()]
public void TestDefaultChoices()
{
Story story = CompileString (@"
- (start)
* [Choice 1]
* [Choice 2]
* {false} Impossible choice
* -> default
- After choice
-> start
== default ==
This is default.
-> DONE
");
Assert.AreEqual ("", story.Continue());
Assert.AreEqual (2, story.currentChoices.Count);
story.ChooseChoiceIndex (0);
Assert.AreEqual ("After choice\n", story.Continue());
Assert.AreEqual (1, story.currentChoices.Count);
story.ChooseChoiceIndex (0);
Assert.AreEqual ("After choice\nThis is default.\n", story.ContinueMaximally());
}
class TestWarningException : System.Exception {}
[Test ()]
public void TestReturnTextWarning()
{
InkParser parser = new InkParser("== test ==\n return something",
null, null,
(string message, ErrorType errorType) => {
if (errorType == ErrorType.Warning) {
throw new TestWarningException ();
}
});
Assert.Throws<TestWarningException>(() => parser.Parse ());
}
[Test ()]
public void TestArithmetic()
{
Story story = CompileString (@"
{ 2 * 3 + 5 * 6 }
{8 mod 3}
{13 % 5}
{ 7 / 3 }
{ 7 / 3.0 }
{ 10 - 2 }
{ 2 * (5-1) }
");
Assert.AreEqual ("36\n2\n3\n2\n2.333333\n8\n8\n", story.ContinueMaximally());
}
[Test ()]
public void TestTurnsSince()
{
Story story = CompileString (@"
{ TURNS_SINCE(-> test) }
~ test()
{ TURNS_SINCE(-> test) }
* [choice 1]
- { TURNS_SINCE(-> test) }
* [choice 2]
- { TURNS_SINCE(-> test) }
== function test ==
~ return
");
Assert.AreEqual ( "-1\n0\n", story.ContinueMaximally());
story.ChooseChoiceIndex (0);
Assert.AreEqual ("1\n", story.ContinueMaximally());
story.ChooseChoiceIndex (0);
Assert.AreEqual ("2\n", story.ContinueMaximally());
}
[Test ()]
public void TestEndOfContent()
{
Story story = CompileString ("Hello world", false, true);
story.ContinueMaximally ();
Assert.IsFalse (HadError());
story = CompileString ("== test ==\nContent\n-> END");
story.ContinueMaximally ();
Assert.IsFalse (story.hasError);
// Should have runtime error due to running out of content
// (needs a -> END)
story = CompileString ("== test ==\nContent", false, true);
story.ContinueMaximally ();
Assert.IsTrue (HadWarning());
// Should have warning that there's no "-> END"
CompileStringWithoutRuntime ("== test ==\nContent", true);
Assert.IsFalse (HadError());
Assert.IsTrue (HadWarning());
CompileStringWithoutRuntime ("== test ==\n~return", testingErrors:true);
Assert.IsTrue (HadError ("Return statements can only be used in knots that are declared as functions"));
CompileStringWithoutRuntime ("== function test ==\n-> END", testingErrors:true);
Assert.IsTrue (HadError ("Functions may not contain diverts"));
}
[Test ()]
public void TestShouldntGatherDueToChoice()
{
Story story = CompileString (@"
* opt
- - text
* * {false} impossible
- gather");
story.ContinueMaximally ();
story.ChooseChoiceIndex (0);
// Shouldn't go to "gather"
Assert.AreEqual ("opt\ntext\n", story.ContinueMaximally());
}
[Test ()]
public void TestOnceOnlyChoicesWithOwnContent()
{
Story story = CompileString (@"
VAR times = 3
-> home
== home ==
~ times = times - 1
{times >= 0:-> eat}
I've finished eating now.
-> END
== eat ==
This is the {first|second|third} time.
* Eat ice-cream[]
* Drink coke[]
* Munch cookies[]
-
-> home
");
story.ContinueMaximally ();
Assert.AreEqual (3, story.currentChoices.Count);
story.ChooseChoiceIndex (0);
story.ContinueMaximally ();
Assert.AreEqual (2, story.currentChoices.Count);
story.ChooseChoiceIndex (0);
story.ContinueMaximally ();
Assert.AreEqual (1, story.currentChoices.Count);
story.ChooseChoiceIndex (0);
story.ContinueMaximally ();
Assert.AreEqual (0, story.currentChoices.Count);
}
[Test ()]
public void TestFunctionPurityChecks()
{
CompileStringWithoutRuntime (@"
-> test
== test ==
~ myFunc()
= function myBadInnerFunc
Not allowed!
~ return
== function myFunc ==
Hello world
* a choice
* another choice
-
-> myFunc
= testStitch
This is a stitch
~ return
", testingErrors:true);
Assert.AreEqual (7,_errorMessages.Count);
Assert.IsTrue(_errorMessages[0].Contains("Return statements can only be used in knots that"));
Assert.IsTrue(_errorMessages[1].Contains("Functions cannot be stitches"));
Assert.IsTrue(_errorMessages[2].Contains("Functions may not contain stitches"));
Assert.IsTrue(_errorMessages[3].Contains("Functions may not contain diverts"));
Assert.IsTrue(_errorMessages[4].Contains("Functions may not contain choices"));
Assert.IsTrue(_errorMessages[5].Contains("Functions may not contain choices"));
Assert.IsTrue(_errorMessages[6].Contains("Return statements can only be used in knots that"));
}
[Test ()]
public void TestFunctionCallRestrictions()
{
CompileStringWithoutRuntime (@"
// Allowed to do this
~ myFunc()
// Not allowed to to this
~ aKnot()
// Not allowed to do this
-> myFunc
== function myFunc ==
This is a function.
~ return
== aKnot ==
This is a normal knot.
-> END
", testingErrors:true);
Assert.AreEqual (2, _errorMessages.Count);
Assert.IsTrue(_errorMessages[0].Contains("hasn't been marked as a function"));
Assert.IsTrue(_errorMessages[1].Contains("can only be called as a function"));
}
[Test ()]
public void TestBasicTunnel()
{
Story story = CompileString (@"
-> f ->
<> world
== f ==
Hello
->->
");
Assert.AreEqual ("Hello world\n", story.Continue());
}
[Test ()]
public void TestComplexTunnels()
{
Story story = CompileString (@"
-> one (1) -> two (2) ->
three (3)
== one(num) ==