~bduggan/raku-protobuf

ea4bbaff81cc6bea320916c812fa3bc10bac6606 — Brian Duggan 7 months ago c5d1e28
tests, makefile
4 files changed, 52 insertions(+), 3 deletions(-)

A Makefile
A make
M t/01-load.rakutest
M t/02-parse.rakutest
A Makefile => Makefile +3 -0
@@ 0,0 1,3 @@
%:
	./make $@


A make => make +43 -0
@@ 0,0 1,43 @@
#!/usr/bin/env raku

if %*ENV<VERBOSE> {
  &shell.wrap: -> |c { say c.raku; callsame; }
  &QX.wrap: -> |c { say c.raku; callsame; }
}

my $module = 'Protobuf';
my $version = q:x[jq -r .version META6.json].trim or exit note 'no version';

multi MAIN('test') {
  shell "TEST_AUTHOR=1 prove -e 'raku -Ilib' t/*";
}

multi MAIN('dist') {
  my $out = "tar/{$module}-{$version}.tar.gz";
  shell qq:to/SH/;
    echo "Making $version";
    mkdir -p tar
    git archive --prefix={$module}-{$version}/ -o $out {$version}
    SH
  say "wrote $out";
}

multi MAIN('docs') {
  shell q:to/SH/;
    script/gen-docs
    SH
}

multi MAIN('bump') {
  my $next = qq:x[raku -e '"$version".split(".") >>+>> <0 0 1> ==> join(".") ==> say()'].trim;
  say "$version -> $next";
  exit note "no next version" unless $next;
  shell qq:to/SH/;
    perl -p -i -e "s/{$version}/{$next}/" META6.json
    SH
}

multi MAIN('clean') {
  shell 'rm -f dist/*.tar.gz';
}


M t/01-load.rakutest => t/01-load.rakutest +1 -1
@@ 4,5 4,5 @@ use Test;

plan 1;

use-ok 'Grammar::Protobuf', 'use gramar';
use-ok 'Protobuf::Grammar', 'use gramar';


M t/02-parse.rakutest => t/02-parse.rakutest +5 -2
@@ 1,9 1,9 @@
#!/usr/bin/env raku

use Test;
use Grammar::Protobuf;
use Protobuf::Grammar;

my \protobuf = Grammar::Protobuf.new;
my \protobuf = Protobuf::Grammar.new;

ok protobuf.parse("package foo.bar;",:rule<package>), 'package';
ok protobuf.parse("foo.bar",:rule<fullIdent>), 'fullIdent';


@@ 106,3 106,6 @@ message outer {
  map<int32, string> my_map = 4;
}
PROTO

done-testing;