diff options
author | murphy <murphy@rubychan.de> | 2011-07-04 00:38:27 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2011-07-04 00:38:27 +0000 |
commit | 6a52b213edf1f146fb72a055466a35fe219e5a0d (patch) | |
tree | 2f0b49ff6ecbce2b24fc56d7eb9a2a883136bc5a /test | |
parent | 498df2b7654c210c8f47e2757efc33cd94689b57 (diff) | |
download | coderay-6a52b213edf1f146fb72a055466a35fe219e5a0d.tar.gz |
cleanups: Page encoder is default for HTML, benchmark KB/s instead of tokens/s
Diffstat (limited to 'test')
-rw-r--r-- | test/executable/suite.rb | 7 | ||||
-rwxr-xr-x | test/functional/basic.rb | 4 | ||||
-rwxr-xr-x | test/functional/examples.rb | 4 | ||||
-rw-r--r-- | test/unit/file_type.rb | 6 |
4 files changed, 11 insertions, 10 deletions
diff --git a/test/executable/suite.rb b/test/executable/suite.rb index ef2ebb3..37acab9 100644 --- a/test/executable/suite.rb +++ b/test/executable/suite.rb @@ -1,4 +1,5 @@ require 'test/unit' +require 'rubygems' unless defined? Gem require 'shoulda-context' require 'pathname' @@ -100,7 +101,7 @@ class TestCodeRayExecutable < Test::Unit::TestCase source = File.read source_file - pre = %r{<pre [^>]*>(.*?)</pre>}m + pre = %r{<td class="code"><pre>(.*?)</pre>}m tag = /<[^>]*>/ should 'not throw an error' do @@ -155,7 +156,7 @@ class TestCodeRayExecutable < Test::Unit::TestCase source = File.read source_file - pre = %r{<pre [^>]*>(.*?)</pre>}m + pre = %r{<td class="code"><pre>(.*?)</pre>}m tag_class = /<span class="([^>"]*)"?[^>]*>/ should 'respect the file extension and highlight the input as Python' do @@ -170,7 +171,7 @@ class TestCodeRayExecutable < Test::Unit::TestCase source = File.read source_file - pre = %r{<pre [^>]*>(.*?)</pre>}m + pre = %r{<td class="code"><pre>(.*?)</pre>}m tag_class = /<span class="([^>"]*)"?[^>]*>/ should 'ignore the file extension and highlight the input as Ruby' do diff --git a/test/functional/basic.rb b/test/functional/basic.rb index c9879dd..dae7de6 100755 --- a/test/functional/basic.rb +++ b/test/functional/basic.rb @@ -64,7 +64,7 @@ class BasicTest < Test::Unit::TestCase end def test_highlight - assert_match '<div class="code"><pre>test</pre></div>', CodeRay.highlight('test', :python) + assert_match '<pre>test</pre>', CodeRay.highlight('test', :python) end def test_highlight_file @@ -173,7 +173,7 @@ more code # and another comment, in-line. def test_encoder_file_extension assert_nothing_raised do - assert_equal 'html', CodeRay::Encoders::HTML::FILE_EXTENSION + assert_equal 'html', CodeRay::Encoders::Page::FILE_EXTENSION assert_equal 'cocoa', Milk::FILE_EXTENSION assert_equal 'cocoa', Milk.new.file_extension assert_equal 'honeybee', HoneyBee::FILE_EXTENSION diff --git a/test/functional/examples.rb b/test/functional/examples.rb index aed7605..f80c90c 100755 --- a/test/functional/examples.rb +++ b/test/functional/examples.rb @@ -24,7 +24,7 @@ end <a href="#n2" name="n2">2</a> <a href="#n3" name="n3">3</a> </pre></td> - <td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><span style="color:#00D">5</span>.times <span style="color:#080;font-weight:bold">do</span> + <td class="code"><pre><span style="color:#00D">5</span>.times <span style="color:#080;font-weight:bold">do</span> puts <span style="background-color:hsla(0,100%,50%,0.08)"><span style="color:#710">'</span><span style="color:#D20">Hello, world!</span><span style="color:#710">'</span></span> <span style="color:#080;font-weight:bold">end</span></pre></td> </tr></table> @@ -38,7 +38,7 @@ end <table class="CodeRay"><tr> <td class="line_numbers" title="double click to toggle" ondblclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre> </pre></td> - <td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">puts <span class="s"><span class="dl">"</span><span class="k">Hello, world!</span><span class="dl">"</span></span></pre></td> + <td class="code"><pre>puts <span class="s"><span class="dl">"</span><span class="k">Hello, world!</span><span class="dl">"</span></span></pre></td> </tr></table> </body> diff --git a/test/unit/file_type.rb b/test/unit/file_type.rb index aa54ba2..dfd5b17 100644 --- a/test/unit/file_type.rb +++ b/test/unit/file_type.rb @@ -74,9 +74,9 @@ class FileTypeTests < Test::Unit::TestCase end def test_html - assert_equal :html, FileType['test.htm'] - assert_equal :xhtml, FileType['test.xhtml'] - assert_equal :xhtml, FileType['test.html.xhtml'] + assert_equal :page, FileType['test.htm'] + assert_equal :page, FileType['test.xhtml'] + assert_equal :page, FileType['test.html.xhtml'] assert_equal :rhtml, FileType['_form.rhtml'] assert_equal :rhtml, FileType['_form.html.erb'] end |