rdiscount 1.2.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,78 @@
1
+ $: << File.join(File.dirname(__FILE__), "../lib")
2
+
3
+ require 'test/unit'
4
+ require 'rdiscount'
5
+
6
+ MARKDOWN_TEST_DIR = "#{File.dirname(__FILE__)}/MarkdownTest_1.0.3"
7
+
8
+ class RDiscountTest < Test::Unit::TestCase
9
+
10
+ def test_that_extension_methods_are_present_on_rdiscount_class
11
+ assert RDiscount.instance_methods.include?('to_html'),
12
+ "RDiscount class should respond to #to_html"
13
+ end
14
+
15
+ def test_that_simple_one_liner_goes_to_html
16
+ markdown = RDiscount.new('Hello World.')
17
+ assert_respond_to markdown, :to_html
18
+ assert_equal "<p>Hello World.</p>\n", markdown.to_html
19
+ end
20
+
21
+ def test_that_inline_markdown_goes_to_html
22
+ markdown = RDiscount.new('_Hello World_!')
23
+ assert_respond_to markdown, :to_html
24
+ assert_equal "<p><em>Hello World</em>!</p>\n", markdown.to_html
25
+ end
26
+
27
+ def test_that_bluecloth_restrictions_are_supported
28
+ markdown = RDiscount.new('Hello World.')
29
+ [:filter_html, :filter_styles].each do |restriction|
30
+ assert_respond_to markdown, restriction
31
+ assert_respond_to markdown, "#{restriction}="
32
+ end
33
+ assert_not_equal true, markdown.filter_html
34
+ assert_not_equal true, markdown.filter_styles
35
+
36
+ markdown = RDiscount.new('Hello World.', :filter_html, :filter_styles)
37
+ assert_equal true, markdown.filter_html
38
+ assert_equal true, markdown.filter_styles
39
+ end
40
+
41
+ def test_that_redcloth_attributes_are_supported
42
+ markdown = RDiscount.new('Hello World.')
43
+ assert_respond_to markdown, :fold_lines
44
+ assert_respond_to markdown, :fold_lines=
45
+ assert_not_equal true, markdown.fold_lines
46
+
47
+ markdown = RDiscount.new('Hello World.', :fold_lines)
48
+ assert_equal true, markdown.fold_lines
49
+ end
50
+
51
+ def test_that_redcloth_to_html_with_single_arg_is_supported
52
+ markdown = RDiscount.new('Hello World.')
53
+ assert_nothing_raised(ArgumentError) { markdown.to_html(true) }
54
+ end
55
+
56
+ # Build tests for each file in the MarkdownTest test suite
57
+
58
+ Dir["#{MARKDOWN_TEST_DIR}/Tests/*.text"].each do |text_file|
59
+
60
+ basename = File.basename(text_file).sub(/\.text$/, '')
61
+ html_file = text_file.sub(/text$/, 'html')
62
+ method_name = basename.gsub(/[-,]/, '').gsub(/\s+/, '_').downcase
63
+
64
+ define_method "test_#{method_name}" do
65
+ markdown = RDiscount.new(File.read(text_file))
66
+ actual_html = markdown.to_html
67
+ assert_not_nil actual_html
68
+ end
69
+
70
+ define_method "test_#{method_name}_with_smarty_enabled" do
71
+ markdown = RDiscount.new(File.read(text_file), :smart)
72
+ actual_html = markdown.to_html
73
+ assert_not_nil actual_html
74
+ end
75
+
76
+ end
77
+
78
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rdiscount
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.6.2
5
+ platform: ruby
6
+ authors:
7
+ - Ryan Tomayko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-06-03 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: r@tomayko.com
18
+ executables: []
19
+
20
+ extensions:
21
+ - ext/extconf.rb
22
+ extra_rdoc_files:
23
+ - README
24
+ - COPYING
25
+ files:
26
+ - README
27
+ - COPYING
28
+ - Rakefile
29
+ - test/benchmark.rb
30
+ - test/benchmark.txt
31
+ - test/MarkdownTest_1.0
32
+ - test/MarkdownTest_1.0.3
33
+ - test/rdiscount_test.rb
34
+ - lib/rdiscount.rb
35
+ - ext/extconf.rb
36
+ - ext/docheader.c
37
+ - ext/dumptree.c
38
+ - ext/generate.c
39
+ - ext/markdown.c
40
+ - ext/mkdio.c
41
+ - ext/rbstrio.c
42
+ - ext/rdiscount.c
43
+ - ext/resource.c
44
+ - ext/amalloc.h
45
+ - ext/config.h
46
+ - ext/cstring.h
47
+ - ext/markdown.h
48
+ - ext/mkdio.h
49
+ - ext/rbstrio.h
50
+ has_rdoc: true
51
+ homepage: http://github.com/rtomayko/rdiscount
52
+ post_install_message:
53
+ rdoc_options: []
54
+
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: "0"
62
+ version:
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ version:
69
+ requirements: []
70
+
71
+ rubyforge_project: wink
72
+ rubygems_version: 1.1.1
73
+ signing_key:
74
+ specification_version: 2
75
+ summary: Fast Implementation of Gruber's Markdown in C
76
+ test_files:
77
+ - test/rdiscount_test.rb