### ----------------------------------------------------
### -- Grammar::Debugger
### -- Licenses: Artistic-2.0
### -- Authors: 
### -- File: t/ltm.rakutest
### ----------------------------------------------------
use Test;

use Grammar::Tracer;

plan 1;

# Test case taken from GitHub Issue #13

grammar MyGrammar {
    proto token test { * }
    token test:sym<first> {
        {} aa
    }
    token test:sym<longest> {
        aa
    }
}

class MyActions {
    method test:sym<first>($/) {
        make 'wrong'
    }
    method test:sym<longest>($/) {
        make 'correct'
    }
}

my $outcome = do {
    my $*OUT = class { method say(*@x) { }; method print(*@x) { }; method flush(*@x) { } }
	MyGrammar.parse('aa', :rule<test>, :actions(MyActions)).made
}
is $outcome, 'correct', 'Picked longest token';

# vim: expandtab shiftwidth=4


