6 use Test::More tests => 15;
8 use Bit::MorseSignals::Receiver;
10 my $pants = new Bit::MorseSignals::Receiver;
11 ok(defined $pants, 'BMR object is defined');
12 is(ref $pants, 'Bit::MorseSignals::Receiver', 'BMR object is valid');
14 my $pants2 = $pants->new;
15 ok(defined $pants2, 'BMR::new called as an object method works' );
16 is(ref $pants2, 'Bit::MorseSignals::Receiver', 'BMR::new called as an object method works is valid');
17 ok(!defined Bit::MorseSignals::Receiver::new(), 'BMR::new called without a class is invalid');
19 eval { $pants2 = new Bit::MorseSignals::Receiver qw/a b c/ };
20 like($@, qr/Optional\s+arguments/, 'BME::new gets parameters as key => value pairs');
23 bless $fake, 'Bit::MorseSignal::Hlagh';
24 for (qw/push reset busy msg/) {
25 eval "Bit::MorseSignals::Receiver::$_('Bit::MorseSignals::Receiver')";
26 like($@, qr/^First\s+argument/, "BMR::$_ isn't a class method");
27 eval "Bit::MorseSignals::Receiver::$_(\$fake)";
28 like($@, qr/^First\s+argument/, "BMR::$_ only applies to BMR objects");
33 ok(!defined($pants->push), 'BMR::push returns undef when \$_ isn\'t defined');