diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2017-06-26 23:57:44 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-26 23:57:44 -0600 |
| commit | 60ae3ec407e4a570b4fd95b115fa279b980fb2ee (patch) | |
| tree | 841ad1663b686729d39134aa1f06cf1111f3cdfd /test | |
| parent | 729b6106b848f6bf5f952d6c64051b5e587815b8 (diff) | |
permit leading, trailing, and repeat operators in target of preprocessor conditional (#2279)
- permit target to begin or end with operator
- don't drop empty conditions as these should be considered
- only call target.empty? once
- optimize conditional stack size check
- add tests
Diffstat (limited to 'test')
| -rw-r--r-- | test/reader_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/reader_test.rb b/test/reader_test.rb index 5a19df8a..82b1d18a 100644 --- a/test/reader_test.rb +++ b/test/reader_test.rb @@ -1526,6 +1526,24 @@ endif::holygrail+swallow[] assert_equal '', (lines * ::Asciidoctor::EOL) end + test 'ifdef should permit leading, trailing, and repeat operators' do + { + 'asciidoctor,' => 'content', + ',asciidoctor' => 'content', + 'asciidoctor+' => '', + '+asciidoctor' => '', + 'asciidoctor,,asciidoctor-version' => 'content', + 'asciidoctor++asciidoctor-version' => '' + }.each do |condition, expected| + input = <<-EOS +ifdef::#{condition}[] +content +endif::[] + EOS + assert_equal expected, (document_from_string input, :parse => false).reader.read + end + end + test 'ifndef with undefined attribute includes block' do input = <<-EOS ifndef::holygrail[] |
