diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2017-12-26 01:59:34 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-26 01:59:34 -0500 |
| commit | de8ed7e7ff4c2e71c0b67f87f9f0988a4aa29887 (patch) | |
| tree | 67f5402f9e11e615bf4a26cb1e201b50d3a47422 /test | |
| parent | ac31ce173f47614edb447b5676bdb0c8f5378dbc (diff) | |
resolves #2519 set authorcount to 0 if there are no authors (PR #2520)
Diffstat (limited to 'test')
| -rw-r--r-- | test/parser_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/parser_test.rb b/test/parser_test.rb index 17aa99af..cfe77794 100644 --- a/test/parser_test.rb +++ b/test/parser_test.rb @@ -526,6 +526,13 @@ context "Parser" do assert_equal 'John Smith', metadata['author_2'] end + test 'skips blank author entries in implicit author line' do + metadata, _ = parse_header_metadata 'Doc Writer; ; John Smith <john.smith@asciidoc.org>;' + assert_equal 2, metadata['authorcount'] + assert_equal 'Doc Writer', metadata['author_1'] + assert_equal 'John Smith', metadata['author_2'] + end + test 'parse name with more than 3 parts in author attribute' do doc = empty_document parse_header_metadata ':author: Leroy Harold Scherer, Jr.', doc @@ -535,6 +542,14 @@ context "Parser" do assert_equal 'Scherer, Jr.', doc.attributes['lastname'] end + test 'sets authorcount to 0 if document has no authors' do + input = '' + doc = empty_document + metadata, _ = parse_header_metadata input, doc + assert_equal 0, doc.attributes['authorcount'] + assert_equal 0, metadata['authorcount'] + end + test 'does not drop name joiner when using multiple authors' do input = <<-EOS Kismet Chameleon; Lazarus het_Draeke |
