diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2014-02-28 21:45:17 -0700 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2014-02-28 21:45:17 -0700 |
| commit | cecea6ba0f0b289277cbc1ec7c6272074223d852 (patch) | |
| tree | ef585e5bb6ff70abab6d0d9bdd7145c05d7eb5d7 | |
| parent | 758c09d074f76cb77182f4900922de683b9921ff (diff) | |
enhance preprocessor test to ensure attribute assignment works
| -rw-r--r-- | test/extensions_test.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/extensions_test.rb b/test/extensions_test.rb index 2ed40a5a..33bada37 100644 --- a/test/extensions_test.rb +++ b/test/extensions_test.rb @@ -32,10 +32,12 @@ end class ScrubHeaderPreprocessor < Asciidoctor::Extensions::Preprocessor def process doc, reader lines = reader.lines + skipped = [] while !lines.empty? && !lines.first.start_with?('=') - lines.shift + skipped << lines.shift reader.advance end + doc.set_attr 'skipped', (skipped * "\n") reader end end @@ -368,6 +370,8 @@ sample content end doc = document_from_string input + assert doc.attr? 'skipped' + assert_equal 'junk line', (doc.attr 'skipped').strip assert doc.has_header? assert_equal 'Document Title', doc.doctitle ensure |
