diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2018-02-22 23:44:44 -0700 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2018-02-23 04:00:03 -0700 |
| commit | 99bcb2a1ee7c55eefc6fde05970b45b2d91042ee (patch) | |
| tree | 51ab9ec87caa1135aadad349b75b702b31d1207f /test | |
| parent | f82c47b786503715b08581e43ba6d6ceb96175a9 (diff) | |
resolves #2574 record timings when calling convert and write on Document
- store timings object on Document
- record timing for convert in Document#convert
- record timing for write in Document#write
Diffstat (limited to 'test')
| -rw-r--r-- | test/api_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/api_test.rb b/test/api_test.rb index 1c39f265..8d52a2db 100644 --- a/test/api_test.rb +++ b/test/api_test.rb @@ -454,6 +454,14 @@ term without description:: assert_kind_of Asciidoctor::List, result[1] assert_kind_of Asciidoctor::ListItem, result[2] end + + test 'timings are recorded for each step when load and convert are called separately' do + sample_input_path = fixture_path 'asciidoc_index.txt' + (Asciidoctor.load_file sample_input_path, :timings => (timings = Asciidoctor::Timings.new)).convert + refute_equal '0.00000', '%05.5f' % timings.read_parse.to_f + refute_equal '0.00000', '%05.5f' % timings.convert.to_f + refute_equal timings.read_parse, timings.total + end end context 'Convert' do @@ -785,5 +793,13 @@ text FileUtils.rm(sample_output_path) end end + + test 'timings are recorded for each step' do + sample_input_path = fixture_path 'asciidoc_index.txt' + Asciidoctor.convert_file sample_input_path, :timings => (timings = Asciidoctor::Timings.new), :to_file => false + refute_equal '0.00000', '%05.5f' % timings.read_parse.to_f + refute_equal '0.00000', '%05.5f' % timings.convert.to_f + refute_equal timings.read_parse, timings.total + end end end |
