Permalink
Browse files

adds more tests

  • Loading branch information...
1 parent dd6dfa9 commit 351679cf3624bf5f625f6c696f0ea2d6dfa471a8 @fxn committed Oct 9, 2009
Showing with 21 additions and 0 deletions.
  1. +5 −0 t/14-native.t
  2. +10 −0 t/22-tagging.t
  3. +6 −0 t/Net/FluidDB/TestUtils.pm
View
@@ -1,7 +1,11 @@
use strict;
use warnings;
+use FindBin qw($Bin);
+use lib $Bin;
+
use Test::More;
+use Net::FluidDB::TestUtils;
use_ok 'Net::FluidDB::Value::Native';
@@ -53,5 +57,6 @@ ok "Net::FluidDB::Value::Integer" eq Net::FluidDB::Value::Native->type_from_alia
ok "Net::FluidDB::Value::Float" eq Net::FluidDB::Value::Native->type_from_alias('float');
ok "Net::FluidDB::Value::String" eq Net::FluidDB::Value::Native->type_from_alias('string');
ok "Net::FluidDB::Value::Set" eq Net::FluidDB::Value::Native->type_from_alias('set');
+ok_dies { Net::FluidDB::Value::Native->type_from_alias('unknown alias') };
done_testing;
View
@@ -199,4 +199,14 @@ ok $value->is_non_native;
ok $value->mime_type eq 'application/json';
ok $value->value eq '{}';
+ok_dies { $object->tag($tag, 0) };
+ok_dies { $object->tag($tag, 7) };
+ok_dies { $object->tag($tag, 3.2) };
+ok_dies { $object->tag($tag, "foo bar") };
+
+ok_dies { $object->tag($tag, 0, fdb_type => 'unknown alias') };
+
+ok_dies { $object->tag($tag, 0, fdb_type => 'integer', mime_type => 'text/plain') };
+ok $object->tag($tag, 0, fdb_type => 'integer', mime_type => Net::FluidDB::Value::Native->mime_type);
+
done_testing;
@@ -8,6 +8,7 @@ our @EXPORT = qw(
skip_all_message
skip_suite_unless_run_all
ok_sets_cmp
+ ok_dies
);
use Time::HiRes 'time';
@@ -44,6 +45,11 @@ sub ok_sets_cmp {
is_deeply [sort @$a], [sort @$b];
}
+sub ok_dies(&) {
+ eval { shift->() };
+ ok $@;
+}
+
sub skip_suite_unless_run_all {
unless ($ENV{NET_FLUIDDB_RUN_FULL_SUITE}) {
plan skip_all => "set NET_FLUIDDB_RUN_FULL_SUITE to run these";

0 comments on commit 351679c

Please sign in to comment.