diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-07-25 01:06:42 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-07-25 01:06:42 +0000 |
commit | 9165b237ad8fae18b36d4d40d6e2ccfde7b136c7 (patch) | |
tree | 06530ddd6baa7e251c58b6b6729ed458da61a681 /t/urn-isbn.t | |
download | URI-tarball-9165b237ad8fae18b36d4d40d6e2ccfde7b136c7.tar.gz |
Diffstat (limited to 't/urn-isbn.t')
-rw-r--r-- | t/urn-isbn.t | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/t/urn-isbn.t b/t/urn-isbn.t new file mode 100644 index 0000000..d8985f7 --- /dev/null +++ b/t/urn-isbn.t @@ -0,0 +1,62 @@ +use strict; +use warnings; + +eval { + require Business::ISBN; +}; +if ($@) { + print "1..0 # Skipped: Needs the Business::ISBN module installed\n\n"; + print $@; + exit; +} + +print "1..13\n"; + +use URI; +my $u = URI->new("URN:ISBN:0395363411"); + +print "not " unless $u eq "URN:ISBN:0395363411" && + $u->scheme eq "urn" && + $u->nid eq "isbn"; +print "ok 1\n"; + +print "not " unless $u->canonical eq "urn:isbn:0-395-36341-1"; +print "ok 2\n"; + +print "not " unless $u->isbn eq "0-395-36341-1"; +print "ok 3\n"; + +print "not " unless $u->isbn_group_code == 0; +print "ok 4\n"; + +print "not " unless $u->isbn_publisher_code == 395; +print "ok 5\n"; + +print "not " unless $u->isbn13 eq "9780395363416"; +print "ok 6\n"; + +print "not " unless $u->nss eq "0395363411"; +print "ok 7\n"; + +print "not " unless $u->isbn("0-88730-866-x") eq "0-395-36341-1"; +print "ok 8\n"; + +print "not " unless $u->nss eq "0-88730-866-x"; +print "ok 9\n"; + +print "not " unless $u->isbn eq "0-88730-866-X"; +print "ok 10\n"; + +print "not " unless URI::eq("urn:isbn:088730866x", "URN:ISBN:0-88-73-08-66-X"); +print "ok 11\n"; + +# try to illegal ones +$u = URI->new("urn:ISBN:abc"); +print "not " unless $u eq "urn:ISBN:abc"; +print "ok 12\n"; + +print "not " if $u->nss ne "abc" || defined $u->isbn; +print "ok 13\n"; + + + |