diff-display 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,25 @@
1
+ # require "test/unit"
2
+ # $:.unshift File.dirname(__FILE__) + "/../lib/"
3
+ # require "diff-display"
4
+ require File.join(File.dirname(__FILE__), "/../lib/diff-display")
5
+
6
+ if RUBY_VERSION > '1.9'
7
+ gem 'test-unit', ">=0"
8
+ class Test::Unit::TestCase
9
+ PASSTHROUGH_EXCEPTIONS = [NoMemoryError, SignalException, Interrupt, SystemExit]
10
+ end
11
+ end
12
+ require 'test/unit'
13
+ require "rubygems"
14
+ gem("mocha", ">=0")
15
+ require "mocha"
16
+ begin
17
+ require "redgreen"
18
+ rescue LoadError
19
+ end
20
+
21
+ module DiffFixtureHelper
22
+ def load_diff(name)
23
+ File.read(File.dirname(__FILE__) + "/fixtures/#{name}.diff")
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ require File.dirname(__FILE__) + "/test_helper"
2
+
3
+ class TestUnified < Test::Unit::TestCase
4
+ include DiffFixtureHelper
5
+
6
+ def test_generates_its_data_structure_via_the_generator
7
+ generator_data = mock("Generator mock")
8
+ Diff::Display::Unified::Generator.expects(:run).returns(generator_data)
9
+ diff = Diff::Display::Unified.new(load_diff("simple"))
10
+ assert_equal generator_data, diff.data
11
+ end
12
+
13
+ def test_renders_a_diff_via_a_callback_and_renders_it_to_a_stringlike_object
14
+ diff = Diff::Display::Unified.new(load_diff("simple"))
15
+ callback = mock()
16
+ callback.expects(:render).returns("foo")
17
+ output = ""
18
+ diff.render(callback, output)
19
+ assert_equal "foo", output
20
+ end
21
+
22
+ end
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: diff-display
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - "Johan S\xC3\xB8rensen"
14
+ - Ketan Padegaonkar
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2011-05-25 00:00:00 +05:30
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: mocha
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ hash: 3
31
+ segments:
32
+ - 0
33
+ version: "0"
34
+ type: :development
35
+ version_requirements: *id001
36
+ description: Diff::Display::Unified renders unified diffs into various forms. The output is based on a callback object that's passed into the renderer
37
+ email:
38
+ - johan@johansorensen.com
39
+ - KetanPadegaonkar@gmail.com
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files:
45
+ - README.txt
46
+ files:
47
+ - .gitignore
48
+ - History.txt
49
+ - License.txt
50
+ - Manifest.txt
51
+ - README.txt
52
+ - Rakefile
53
+ - doc/.gitignore
54
+ - lib/diff-display.rb
55
+ - lib/diff/display/data_structure.rb
56
+ - lib/diff/display/unified.rb
57
+ - lib/diff/display/unified/generator.rb
58
+ - lib/diff/display/version.rb
59
+ - lib/diff/renderer/base.rb
60
+ - lib/diff/renderer/diff.rb
61
+ - script/destroy
62
+ - script/generate
63
+ - script/txt2html
64
+ - setup.rb
65
+ - test/fixtures/big.diff
66
+ - test/fixtures/multiple_adds_after_rem.diff
67
+ - test/fixtures/multiple_rems_then_add.diff
68
+ - test/fixtures/only_add.diff
69
+ - test/fixtures/only_rem.diff
70
+ - test/fixtures/pseudo_recursive.diff
71
+ - test/fixtures/simple.diff
72
+ - test/fixtures/simple_oneliner.diff
73
+ - test/fixtures/simple_rewrite.diff
74
+ - test/test_api.rb
75
+ - test/test_base_renderer.rb
76
+ - test/test_datastructure.rb
77
+ - test/test_diff_renderer.rb
78
+ - test/test_generator.rb
79
+ - test/test_helper.rb
80
+ - test/test_unified.rb
81
+ - diff-display.gemspec
82
+ has_rdoc: true
83
+ homepage: http://github.com/ketan/diff-display
84
+ licenses: []
85
+
86
+ post_install_message:
87
+ rdoc_options: []
88
+
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ hash: 3
97
+ segments:
98
+ - 0
99
+ version: "0"
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ hash: 3
106
+ segments:
107
+ - 0
108
+ version: "0"
109
+ requirements: []
110
+
111
+ rubyforge_project:
112
+ rubygems_version: 1.6.2
113
+ signing_key:
114
+ specification_version: 3
115
+ summary: Diff::Display::Unified renders unified diffs into various forms.
116
+ test_files:
117
+ - test/test_api.rb
118
+ - test/test_base_renderer.rb
119
+ - test/test_datastructure.rb
120
+ - test/test_diff_renderer.rb
121
+ - test/test_generator.rb
122
+ - test/test_helper.rb
123
+ - test/test_unified.rb