Skip to content

Commit

Permalink
More sane & clear tests for Markout output
Browse files Browse the repository at this point in the history
  • Loading branch information
karmi committed Jul 3, 2009
1 parent 98f1f42 commit 69e7a43
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
15 changes: 12 additions & 3 deletions test/fixtures/markdown.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
h1, h2, h3, h4, h5, h6 {
color: #222;
}
h1, h2 {
h1, h2, h3, h4 {
color: #172533;
font-weight: normal;
}
Expand All @@ -87,8 +87,7 @@

h3 {
color: #172533;
font-size: 1.1em;
font-weight:bold;
font-size: 1.3em;
letter-spacing:-1px;
padding: 1em 0 0 0;
margin: 1.8em 0 0.25em 0;
Expand All @@ -99,6 +98,14 @@
text-decoration:underline;
}

h4 {
font-size: 1.15em;
letter-spacing:-1px;
padding: 0.5em 0 0 0;
margin: 1em 0 0.25em 0;
border-top: 1px solid #e0e6ee;
}

p {
margin: 0 0 0.8em 0;
}
Expand Down Expand Up @@ -165,10 +172,12 @@
}

#history .revision h4 {
font-size: 95%;
margin: 0;
padding: 0 0 0 0.7em;
}
#history .revision.expanded h4 {
font-size: 100%;
}

#history .revision .detail {
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/markdown.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,4 @@ also deserve thanks for their feedback.
[Michel Fortin]: http://www.michelf.com/projects/php-markdown/
[html2text]: http://www.aaronsw.com/2002/html2text/

[tfmenu]: mt_textformat_menu.png
[tfmenu]: mt_textformat_menu.png
17 changes: 12 additions & 5 deletions test/markout_output_test.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
require File.join(File.dirname(__FILE__), 'test_helper')
require 'markout/output'
require 'tempfile'

module Markout
class OutputTest < Test::Unit::TestCase

def setup
default_output
end

def test_default_initialization
assert_nothing_raised { default_output }
assert_not_nil @output.document
Expand All @@ -13,13 +18,15 @@ def test_default_initialization
end

def test_export
default_output
assert_equal fixture('markdown.html'), @output.export, "Exported text does not match output"
tmpfile = Tempfile.new('markout_test.html')
tmpfile.puts @output.export
tmpfile.close
# Hats down to @kubicek for the "let's diff huge chunks of text in tests!" idea!!!
diff = `diff -u #{File.expand_path(File.dirname(__FILE__))}/fixtures/markdown.html #{tmpfile.path}`
assert diff.chomp == '', "Fixture HTML does not match Markout output, see diff below:\n" + diff
end

def test_export_to_file
# TODO
end
private

def default_output
@output = Output.new( fixture_file('markdown.txt'), :history => false )
Expand Down

0 comments on commit 69e7a43

Please sign in to comment.