tracks/perl6/exercises/bob/example.yaml in trackler-2.2.1.72 vs tracks/perl6/exercises/bob/example.yaml in trackler-2.2.1.73
- old
+ new
@@ -1,7 +1,7 @@
exercise: Bob
-version: 1
+version: 2
plan: 28
methods: hey
tests: |-
# Go through the cases and check that Bob gives us the correct responses.
is ::($exercise).?hey(.<input>), |.<expected description> for @($c-data<cases>);
@@ -21,15 +21,19 @@
#`[
Declare class 'Bob' with version and unit-scope the class
i.e. everything in this file is part of 'Bob'.
]
example: |-
- method hey ($msg) {
- given $msg.trim {
- when !* { 'Fine. Be that way!' }
- when /<:Upper>/ and $_.uc eq * { 'Whoa, chill out!' }
- when /'?'$/ { 'Sure.' }
- default { 'Whatever.' }
+ method hey ( Str:D $_ --> Str:D ) {
+ my \shouting = /<:L>/ ^ /<:Ll>/;
+ given .trim {
+ when .ends-with: ‘?’ {
+ when shouting { ‘Calm down, I know what I'm doing!’ }
+ default { ‘Sure.’ }
+ }
+ when shouting { ‘Whoa, chill out!’ }
+ when .not { ‘Fine. Be that way!’ }
+ default { ‘Whatever.’ };
}
}
stub: |-
method hey ($msg) {
#`[