File: 04-entry.t

package info (click to toggle)
libbibtex-parser-perl 1.93%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 264 kB
  • sloc: perl: 1,391; makefile: 2
file content (42 lines) | stat: -rw-r--r-- 997 bytes parent folder | download | duplicates (7)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/perl -w

use Test::More tests => 13;

use BibTeX::Parser::Entry;


my $entry = new BibTeX::Parser::Entry("type", "key", 1, {title => "title"});

isa_ok($entry, "BibTeX::Parser::Entry");

is($entry->type, "TYPE", "Entry::type get");

$entry->type("newtype");

is($entry->type, "NEWTYPE", "Entry::type set");

is($entry->key, "key", "Entry::key get");

$entry->key("newkey");

is($entry->key, "newkey", "Entry::key set");

is($entry->field("title"), "title", "Entry::field with new");

$entry->field("title" => "newtitle");

is($entry->field("title"), "newtitle", "Entry::field overwrite");

$entry->field("year" => 2008);

is($entry->field("year"), 2008, "Entry::field set");

is($entry->field("pages"), undef, "Entry::field undef on unknown value");

is($entry->fieldlist, 2, "size of fieldlist");

ok($entry->has("title"), "Entry::has true on known value");

ok($entry->has("year"), "Entry::has true on known value");

ok( ! $entry->has("pages"), "Entry::has false on unknown value");