Skip to content

Update processing for current gem versions [fny] #92

Open
wants to merge 1 commit into from

1 participant

@fny
fny commented Apr 27, 2012

Hotfix to add specific loading sequence for each gem to fix current errors. Documentation will render correctly, however encoding issues and HTML mismatches arise during testing.

@fny fny Update processing for current gem versions [fny]
Add specific loading sequence for each gem to fix current errors
4277a65
@fny
fny commented Apr 27, 2012

Apologies if a pull request was inappropriate. I'm fairly new to the git workflow.

There are still some encoding and output comparison errors when running the tests. However, loading issues have been resolved and the doc output looks fine. From the nature of the output errors, I'm assuming that the tests need to be updated to compare output specific to the current gem versions as well.

Object instantiation is made specific to each library as opposed to the current generalization currently employed in process_markdown. Loading issues with Redcarpet, for instance, have been resolved. The tests have been included below.

Note I did not stage an updated gemspec.

Also, I considered adding a means to load a different gem if the output failed to produce HTML, but time didn't permit. Here's some shoddy, cumbersome pseudocode:

md_factories = [{
:library=> 'gem',
:processor=>"Library.new(text).to_html"
},
{
...
}
]
for i in md_factory do
if gem_available?
require 'gem'
text="sample"
mdf = eval md_factories[:processor]
break if mdf.class == String
end
raise 'All libraries failed' if md_factories.empty?

Testing

The gem builds without any issues:

gem build rocco.gemspec
WARNING:  description and summary are identical
  Successfully built RubyGem
  Name: rocco
  Version: 0.8.2
  File: rocco-0.8.2.gem
mv rocco-0.8.2.gem pkg/rocco-0.8.2.gem
gem install pkg/rocco-0.8.2.gem
Fetching: redcarpet-1.17.2.gem (100%)
Building native extensions.  This could take a while...
Successfully installed redcarpet-1.17.2
Successfully installed rocco-0.8.2
2 gems installed

Redcarpet

rake test:

Run options: 

# Running tests:

....Error: no lexer for alias 'not-a-language' found
........................F..E...............

Finished tests in 11.809327s, 3.9799 tests/s, 5.8428 assertions/s.

  1) Failure:
test_highlighted_in_blocks(RoccoDocblockAnnotationsTest) [/Users/user/Playground/rocco/test/test_docblock_annotations.rb:18]:
<"<p>Comment</p><blockquote><p><strong>param</strong> type name</p></blockquote>\n"> expected but was
<"<p>Comment\n&gt; <strong>param</strong> type name  </p>\n">.

  2) Error:
test_issue10_utf8_processing(RoccoIssueTests):
ArgumentError: invalid byte sequence in UTF-8
    /Users/user/Playground/rocco/lib/rocco.rb:230:in `split'
    /Users/user/Playground/rocco/lib/rocco.rb:230:in `parse'
    /Users/user/Playground/rocco/lib/rocco.rb:130:in `initialize'
    /Users/user/Playground/rocco/test/test_reported_issues.rb:33:in `new'
    /Users/user/Playground/rocco/test/test_reported_issues.rb:33:in `test_issue10_utf8_processing'

47 tests, 69 assertions, 1 failures, 1 errors, 0 skips
rake aborted!
Command failed with status (2): [/Users/user/.rvm/rubies/ruby-1.9.3-...]

Tasks: TOP => test
(See full trace by running task with --trace)

RDiscount

rake test:

Run options: 

# Running tests:

....Error: no lexer for alias 'not-a-language' found
........................F..E...............

Finished tests in 11.768141s, 3.9938 tests/s, 5.8633 assertions/s.

  1) Failure:
test_highlighted_in_blocks(RoccoDocblockAnnotationsTest) [/Users/user/Playground/rocco/test/test_docblock_annotations.rb:18]:
<"<p>Comment</p><blockquote><p><strong>param</strong> type name</p></blockquote>\n"> expected but was
<"<p>Comment</p>\n\n<blockquote><p><strong>param</strong> type name</p></blockquote>\n">.

  2) Error:
test_issue10_utf8_processing(RoccoIssueTests):
ArgumentError: invalid byte sequence in UTF-8
    /Users/user/Playground/rocco/lib/rocco.rb:230:in `split'
    /Users/user/Playground/rocco/lib/rocco.rb:230:in `parse'
    /Users/user/Playground/rocco/lib/rocco.rb:130:in `initialize'
    /Users/user/Playground/rocco/test/test_reported_issues.rb:33:in `new'
    /Users/user/Playground/rocco/test/test_reported_issues.rb:33:in `test_issue10_utf8_processing'

47 tests, 69 assertions, 1 failures, 1 errors, 0 skips
rake aborted!
Command failed with status (2): [/Users/user/.rvm/rubies/ruby-1.9.3-...]

Tasks: TOP => test
(See full trace by running task with --trace)

BlueCloth

rake test:

....Error: no lexer for alias 'not-a-language' found
....F.........F.........F..F..F............

Finished tests in 11.654129s, 4.0329 tests/s, 5.6632 assertions/s.

  1) Failure:
test_sections(RoccoBasicTests) [/Users/user/Playground/rocco/test/test_basics.rb:22]:
<"<p>Comment 1</p>\n"> expected but was
<"<p>Comment 1</p>">.

  2) Failure:
test_language_without_single_line_comments_highlight(RoccoBlockCommentTest) [/Users/user/Playground/rocco/test/test_block_comments.rb:90]:
<"<p>Comment 2</p>\n"> expected but was
<"<p>Comment 2</p>">.

  3) Failure:
test_highlighted_in_blocks(RoccoDocblockAnnotationsTest) [/Users/user/Playground/rocco/test/test_docblock_annotations.rb:18]:
<"<p>Comment</p><blockquote><p><strong>param</strong> type name</p></blockquote>\n"> expected but was
<"<p>Comment</p>\n\n<blockquote><p><strong>param</strong> type name</p></blockquote>">.

  4) Failure:
test_issue10_utf8_processing(RoccoIssueTests) [/Users/user/Playground/rocco/test/test_reported_issues.rb:26]:
UTF-8 input files ought behave correctly..
<"<p>hello ąćęłńóśźż</p>\n"> expected but was
<"<p>hello ąćęłńóśźż</p>">.

  5) Failure:
test_issue15_extra_space_after_comment_character_remains(RoccoIssueTests) [/Users/user/Playground/rocco/test/test_reported_issues.rb:84]:
<"<h2>Comment 1</h2>\n"> expected but was
<"<h2>Comment 1</h2>">.

47 tests, 66 assertions, 5 failures, 0 errors, 0 skips
rake aborted!
Command failed with status (5): [/Users/user/.rvm/rubies/ruby-1.9.3-...]

Tasks: TOP => test
(See full trace by running task with --trace)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.