test/makeup/syntax_highlighter_test.rb in makeup-0.3.0 vs test/makeup/syntax_highlighter_test.rb in makeup-0.4.0

- old
+ new

@@ -60,49 +60,18 @@ assert_match "<span class=\"nt\">&lt;h1&gt;</span>", html assert_match "Hey<span class=\"nt\">&lt;/h1&gt;</span>", html end - it "highlights file with custom suffix" do - Makeup::SyntaxHighlighter.add_lexer_alias("derp", "rb") - html = highlight("file.derp", "class File") - - assert_match "<span class=\"k\">class</span>", html - assert_match "<span class=\"nc\">File</span>", html - end - it "skips highlighting if lexer is missing" do html = highlight("file.trololol", "Yeah yeah yeah") assert_equal "Yeah yeah yeah", html end end describe "#lexer" do it "uses known suffix" do - assert_equal "rb", @highlighter.lexer("file.rb") - end - - it "uses registered suffix" do - Makeup::SyntaxHighlighter.add_lexer_alias("blarg", "blarg") - assert_equal "blarg", @highlighter.lexer("file.blarg") - end - - it "uses registered lexer" do - Makeup::SyntaxHighlighter.add_lexer_alias("bg", "blarg") - assert_equal "blarg", @highlighter.lexer("file.bg") - end - - it "uses known shebang" do - assert_equal "rb", @highlighter.lexer("some-binary", "#!/usr/bin/env ruby\n") - end - - it "uses registered shebang" do - Makeup::SyntaxHighlighter.add_lexer_shebang(/\bnode\b/, "js") - assert_equal "js", @highlighter.lexer("some-binary", "#!/usr/bin/env node\n") - end - - it "uses filename for unknown lexer" do - assert_equal "some-binary", @highlighter.lexer("some-binary", "class Person\nend") + assert_equal "ruby", @highlighter.lexer("file.rb") end end end