diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2021-05-06 23:59:42 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-06 23:59:42 -0600 |
| commit | f2a4ab291e116aad00fb94f8ac49c6214e6ea3c9 (patch) | |
| tree | 6af6db2eeeb28f47041dd5a054ca189ab7f6a8ec /test/reader_test.rb | |
| parent | bb2b489d965e10e279f7af8758d7e7e8e254d807 (diff) | |
resolve #4046 change ifeval directive to resolve to false if comparison operation cannot be performed (PR #4047)
Diffstat (limited to 'test/reader_test.rb')
| -rw-r--r-- | test/reader_test.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/reader_test.rb b/test/reader_test.rb index 985a3361..cf566ea1 100644 --- a/test/reader_test.rb +++ b/test/reader_test.rb @@ -2267,6 +2267,38 @@ class ReaderTest < Minitest::Test assert_equal '', (lines * ::Asciidoctor::LF) end + test 'ifeval running unsupported operation on missing attribute drops content' do + input = <<~'EOS' + ifeval::[{leveloffset} >= 3] + I didn't make the cut! + endif::[] + EOS + + doc = Asciidoctor::Document.new input + reader = doc.reader + lines = [] + while reader.has_more_lines? + lines << reader.read_line + end + assert_equal '', (lines * ::Asciidoctor::LF) + end + + test 'ifeval running invalid operation drops content' do + input = <<~'EOS' + ifeval::[{asciidoctor-version} > true] + I didn't make the cut! + endif::[] + EOS + + doc = Asciidoctor::Document.new input + reader = doc.reader + lines = [] + while reader.has_more_lines? + lines << reader.read_line + end + assert_equal '', (lines * ::Asciidoctor::LF) + end + test 'ifeval comparing double-quoted attribute to matching string includes content' do input = <<~'EOS' ifeval::["{gem}" == "asciidoctor"] |
