Diffing different version outputs

Ovid on 2005-05-15T20:01:16

After playing around with a new parser for AI::Prolog, I realized that I was being stupid. I was visually comparing the differences between my old and new parsers. How silly of me! A bit of namespace massaging gave me this:

use Test::More 'no_plan';
use Test::Differences;
use AI::Prolog::Parser; # must come before the use lib
use lib 'AI-Prolog-0.66/lib';
use AI::Prolog::ParserTwo;

my $parser1 = AI::Prolog::Parser->new;
my $parser2 = AI::Prolog::ParserTwo->new;

my @clauses = (
  'foo.',
  'bar.',
  '3.',
  'foo(bar).',
);

foreach my $clause (@clauses) {
  my $kb1 = $parser1->consult($clause);
  my $kb2 = $parser2->consult($clause);
  eq_or_diff $kb1, $kb2,
    "Parsers should return identical values for ($clause)";
}