Sha256: 2fbe28ded742175b403871ea5247527c82c72f3009cf1d08dd6613df83084268
Contents?: true
Size: 1.37 KB
Versions: 4
Compression:
Stored size: 1.37 KB
Contents
require 'albino' require 'rubygems' require 'test/unit' require 'tempfile' require 'mocha' class AlbinoTest < Test::Unit::TestCase def setup @syntaxer = Albino.new(File.new(__FILE__), :ruby) end def test_defaults_to_text syntaxer = Albino.new('abc') regex = /span/ assert_no_match regex, syntaxer.colorize end def test_accepts_options assert_match /span/, @syntaxer.colorize end def test_accepts_non_alpha_options assert_equal '', @syntaxer.colorize(:f => 'html+c#-dump') end def test_works_with_strings syntaxer = Albino.new("class New\nend", :ruby) assert_match %r(highlight), syntaxer.colorize end def test_works_with_files contents = "class New\nend" syntaxer = Albino.new(contents, :ruby) file_output = syntaxer.colorize Tempfile.open 'albino-test' do |tmp| tmp << contents tmp.flush syntaxer = Albino.new(File.new(tmp.path), :ruby) assert_equal file_output, syntaxer.colorize end end def test_aliases_to_s syntaxer = Albino.new(File.new(__FILE__), :ruby) assert_equal @syntaxer.colorize, syntaxer.to_s end def test_class_method_colorize assert_equal @syntaxer.colorize, Albino.colorize(File.new(__FILE__), :ruby) end def test_escaped_shell_args assert_raises Albino::ShellArgumentError do @syntaxer.convert_options(:l => "'abc;'") end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
albino-1.2.3 | test/albino_test.rb |
albino-1.2.2 | test/albino_test.rb |
albino-1.2.1 | test/albino_test.rb |
albino-1.2.0 | test/albino_test.rb |