-
-
Notifications
You must be signed in to change notification settings - Fork 942
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(jenny): Add testScenario() test method (#2147)
Add testScenario() method for jenny, allowing to test different dialogues more easily. This is the same system as used by YarnSpinner, so that we can verify that language features are working the same way. Some of the testplans from YarnSpinner were ported, though many of them are marked as skip=true. This gives us an opportunity to try TDD.
- Loading branch information
Showing
11 changed files
with
593 additions
and
15 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
31 changes: 31 additions & 0 deletions
31
packages/flame_jenny/jenny/test/structure/commands/if_command_test.dart
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,31 @@ | ||
import 'package:test/test.dart'; | ||
|
||
import '../../test_scenario.dart'; | ||
|
||
void main() { | ||
group('IfCommand', () { | ||
testScenario( | ||
testName: 'IfStatements.yarn', | ||
input: ''' | ||
title: Start | ||
--- | ||
<<if true>> | ||
Player: Hey, Sally. #line:794945 | ||
Sally: Oh! Hi. #line:2dc39b | ||
Sally: You snuck up on me. #line:34de2f | ||
Sally: Don't do that. #line:dcc2bc | ||
<<else>> | ||
Player: Hey. #line:a8e70c | ||
Sally: Hi. #line:305cde | ||
<<endif>> | ||
=== | ||
''', | ||
testPlan: ''' | ||
line: Player: Hey, Sally. | ||
line: Sally: Oh! Hi. | ||
line: Sally: You snuck up on me. | ||
line: Sally: Don't do that. | ||
''', | ||
); | ||
}); | ||
} |
60 changes: 60 additions & 0 deletions
60
packages/flame_jenny/jenny/test/structure/commands/set_command_test.dart
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,60 @@ | ||
import 'package:test/test.dart'; | ||
|
||
import '../../test_scenario.dart'; | ||
|
||
void main() { | ||
group('SetCommand', () { | ||
testScenario( | ||
testName: 'AnalysisTest.plan', | ||
input: r''' | ||
title: Start | ||
--- | ||
// testing | ||
<<declare $foo = 0>> // used | ||
<<declare $bar = 0>> // written to but never read | ||
<<set $foo to 1>> | ||
<<set $bar to $foo>> | ||
{$foo} {$bar} | ||
=== | ||
''', | ||
testPlan: 'line: 1 1', | ||
skip: true, | ||
); | ||
|
||
testScenario( | ||
testName: 'Basic.plan', | ||
input: r''' | ||
title: Start | ||
--- | ||
whoa what here's some text | ||
<<set $foo to (1+3*3/9)-1>> | ||
<<if $foo is 1>> // testing a comment | ||
this should appear :) | ||
<<if 1 is 1>> | ||
NESTED IF BLOCK WHAAAT | ||
<<set $foo += 47 + 6>> | ||
<<endif>> | ||
<<else>> | ||
oh noooo it didn't work :( | ||
<<endif>> | ||
<<if $foo is 54>> | ||
haha nice now 'set' works even when deeply nested | ||
<<else>> | ||
aaargh :( | ||
<<endif>> | ||
=== | ||
''', | ||
testPlan: ''' | ||
line: whoa what here's some text | ||
line: this should appear :) | ||
line: NESTED IF BLOCK WHAAAT | ||
line: haha nice now 'set' works even when deeply nested | ||
''', | ||
skip: true, | ||
); | ||
}); | ||
} |
56 changes: 56 additions & 0 deletions
56
packages/flame_jenny/jenny/test/structure/commands/user_defined_command_test.dart
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,56 @@ | ||
import 'package:test/test.dart'; | ||
|
||
import '../../test_scenario.dart'; | ||
|
||
void main() { | ||
group('UserDefinedCommand', () { | ||
testScenario( | ||
testName: 'Commands.yarn', | ||
input: ''' | ||
title: Start | ||
--- | ||
// Testing commands | ||
<<flip Harley3 +1>> | ||
// Commands that begin with keywords | ||
<<toggle>> | ||
<<settings>> | ||
<<iffy>> | ||
<<nulled>> | ||
<<orion>> | ||
<<andorian>> | ||
<<note>> | ||
<<isActive>> | ||
// Commands with a single character | ||
<<p>> | ||
// Commands with colons | ||
<<hide Collision:GermOnPorch>> | ||
=== | ||
''', | ||
testPlan: ''' | ||
command: flip Harley3 +1 | ||
command: toggle | ||
command: settings | ||
command: iffy | ||
command: nulled | ||
command: orion | ||
command: andorian | ||
command: note | ||
command: isActive | ||
command: p | ||
command: hide Collision:GermOnPorch | ||
''', | ||
skip: true, | ||
); | ||
}); | ||
} |
Oops, something went wrong.