File: test_steps.pl

package info (click to toggle)
libtest-bdd-cucumber-perl 0.26-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 528 kB
  • sloc: perl: 3,436; makefile: 8
file content (26 lines) | stat: -rw-r--r-- 546 bytes parent folder | download
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/perl

use strict;
use warnings;
use Test::More;
use Test::BDD::Cucumber::StepFile;
use Digest::MD5;

Given qr/a Digest MD5 object/, sub {
    S->{digest} = Digest::MD5->new;
};

When qr/I add "([^"]+)" to the object/, sub {
    S->{digest}->add( C->matches->[0] );
};

Then qr/the results look like/, sub {
	my $data   = C->data;
	my $digest = S->{digest};
    foreach my $row (@{$data}) {
		my $func   = $row->{method};
		my $expect = $row->{output};
		my $got    = $digest->$func();
        is $got, $expect, "test: $func";
    }
};