aboutsummaryrefslogtreecommitdiff
path: root/challenge-107/aaronreidsmith/raku/ch-2.raku
blob: a199bfadc1bf4e914efd5dd5ca1102ef4a4eb461 (plain)
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
#!/usr/bin/env raku

# Used for testing
class Calc {
    method add {}
    method mul {}
    method div {}
}

sub challenge(Any $class) returns Str {
    $class.^methods.map(*.gist).join("\n");
}

multi sub MAIN(Bool :$main) {
    say challenge(Calc.new);
}

multi sub MAIN(Bool :$test) {
    use Test;

    my $test-class = Calc.new;

    is(challenge($test-class), "add\nmul\ndiv\nBUILDALL");

    done-testing;
}