ciat 0.4.8 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. data/README.rdoc +4 -4
  2. data/lib/ciat.rb +3 -5
  3. data/lib/ciat/differs/html_differ.rb +3 -4
  4. data/lib/ciat/erb_helpers.rb +6 -4
  5. data/lib/ciat/feedback/composite.rb +2 -2
  6. data/lib/ciat/feedback/feedback_counter.rb +2 -2
  7. data/lib/ciat/feedback/html_feedback.rb +25 -8
  8. data/lib/ciat/feedback/html_feedback_builder.rb +28 -0
  9. data/lib/ciat/feedback/return_status.rb +1 -1
  10. data/lib/ciat/feedback/standard_output.rb +1 -1
  11. data/lib/ciat/io.rb +17 -0
  12. data/lib/ciat/processors/basic_processing.rb +21 -30
  13. data/lib/ciat/{executors → processors}/java.rb +7 -8
  14. data/lib/ciat/{executors → processors}/parrot.rb +9 -10
  15. data/lib/ciat/rake_task.rb +1 -1
  16. data/lib/ciat/subresult.rb +20 -0
  17. data/lib/ciat/suite.rb +27 -38
  18. data/lib/ciat/suite_builder.rb +54 -0
  19. data/lib/ciat/test.rb +32 -18
  20. data/lib/ciat/test_element.rb +7 -2
  21. data/lib/ciat/{crate.rb → test_file.rb} +24 -16
  22. data/lib/ciat/test_result.rb +24 -0
  23. data/lib/ciat/traffic_light.rb +6 -0
  24. data/lib/templates/detail_row.html.erb +5 -4
  25. data/lib/templates/group_header.html.erb +2 -2
  26. data/lib/templates/report.html.erb +1 -1
  27. data/lib/templates/summary_row.html.erb +4 -4
  28. data/spec/ciat/erb_helpers_spec.rb +71 -0
  29. data/spec/ciat/feedback/composite_spec.rb +28 -0
  30. data/spec/ciat/feedback/feedback_counter_spec.rb +91 -0
  31. data/spec/ciat/feedback/html_feedback_spec.rb +48 -0
  32. data/spec/ciat/feedback/return_status_spec.rb +90 -0
  33. data/spec/ciat/feedback/standard_output_spec.rb +109 -0
  34. data/spec/ciat/processors/basic_processing_spec.rb +146 -0
  35. data/spec/ciat/processors/java_spec.rb +31 -0
  36. data/spec/ciat/processors/parrot_spec.rb +40 -0
  37. data/spec/ciat/subresult_spec.rb +40 -0
  38. data/spec/ciat/suite_builder_spec.rb +70 -0
  39. data/spec/ciat/suite_spec.rb +64 -0
  40. data/spec/ciat/test_element_spec.rb +78 -0
  41. data/spec/ciat/test_file_spec.rb +96 -0
  42. data/spec/ciat/test_spec.rb +127 -0
  43. data/spec/ciat/traffic_light_spec.rb +41 -0
  44. data/spec/ciat_spec.rb +2 -0
  45. data/spec/spec_helper.rb +134 -0
  46. data/spec/templates/detail_row/elements_html_erb_spec.rb +60 -0
  47. data/spec/templates/detail_row_html_erb_spec.rb +73 -0
  48. data/spec/templates/elements/diff_html_erb_spec.rb +28 -0
  49. data/spec/templates/elements/plain_element_html_erb_spec.rb +36 -0
  50. data/spec/templates/report_html_erb_spec.rb +85 -0
  51. data/spec/templates/summary_row_html_erb_spec.rb +93 -0
  52. data/spec/templates/test_numbers_html_erb_spec.rb +82 -0
  53. metadata +54 -32
  54. data/History.txt +0 -96
  55. data/Rakefile +0 -40
  56. data/ciat.gemspec +0 -53
  57. data/lib/ciat/cargo.rb +0 -55
  58. data/lib/ciat/compilers/java.rb +0 -54
  59. data/lib/ciat/processors/copy.rb +0 -37
  60. data/lib/ciat/version.rb +0 -7
@@ -0,0 +1,93 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ require 'hpricot'
4
+
5
+ describe "summary row of test report" do
6
+ include ERBHelpers
7
+ include CustomDetailRowMatchers
8
+
9
+ attr_reader :erb
10
+ attr_reader :recursion
11
+
12
+ before(:each) do
13
+ @result = mock('result')
14
+ @result.stub!(:filename).and_return("the filename")
15
+ @recursion = mock('recursion')
16
+ @erb = build_erb("lib/templates/summary_row.html.erb")
17
+ end
18
+
19
+ it "should work with no processors" do
20
+ expect_description("the description")
21
+ @result.should_receive(:subresults).at_least(:once).and_return([])
22
+
23
+ doc = process_erb
24
+ doc.should have_description("the description")
25
+ doc.should have_none("/tr/td[2]")
26
+ end
27
+
28
+ it "should work with one processor" do
29
+ subresult, light = mock("subresult"), mock("light")
30
+
31
+ expect_description("one proc description")
32
+ @result.should_receive(:subresults).
33
+ at_least(:once).and_return([subresult])
34
+
35
+ expect_light(subresult, :light_setting, "the light")
36
+
37
+ doc = process_erb
38
+ doc.should have_description("one proc description")
39
+ doc.should have_light(:light_setting, "the light")
40
+ doc.should have_none("/tr/td[3]")
41
+ end
42
+
43
+ it "should work with many processors" do
44
+ subresults = [mock("subresult 0"), mock("subresult 1"), mock("subresult 2")]
45
+
46
+ expect_description("description three")
47
+ @result.should_receive(:subresults).at_least(:once).and_return(subresults)
48
+
49
+ expect_light(subresults[0], :light0, "word 0")
50
+ expect_light(subresults[1], :light1, "word 1")
51
+ expect_light(subresults[2], :light2, "word 2")
52
+
53
+ doc = process_erb
54
+ doc.should have_description("description three")
55
+ doc.should have_light(:light0, "word 0")
56
+ doc.should have_light(:light1, "word 1")
57
+ doc.should have_light(:light2, "word 2")
58
+ doc.should have_none("/tr/td[5]")
59
+ end
60
+
61
+ def expect_light(subresult, setting, word)
62
+ light = mock("mock #{setting}")
63
+ subresult.should_receive(:light).at_least(:once).and_return(light)
64
+ light.should_receive(:setting).and_return(setting)
65
+ light.should_receive(:text).and_return(word)
66
+ end
67
+
68
+ def expect_description(text)
69
+ description = mock("description")
70
+ @result.should_receive(:element).with(:description).and_return(description)
71
+ description.should_receive(:content).and_return(text)
72
+ end
73
+
74
+ def fake(what, content)
75
+ "<div class=\"fake\"><div id=\"#{what}\">#{content}</div></div>"
76
+ end
77
+
78
+ def have_light(css_class, light)
79
+ have_inner_html(".#{css_class}", light)
80
+ end
81
+
82
+ def have_description(expected)
83
+ have_inner_html("/tr/td[1]/a", expected)
84
+ end
85
+
86
+ def light_to_word(light)
87
+ light.text
88
+ end
89
+
90
+ def result
91
+ @result
92
+ end
93
+ end
@@ -0,0 +1,82 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper.rb'
2
+
3
+ require 'hpricot'
4
+
5
+ describe "summary row of test report" do
6
+ include ERBHelpers
7
+ include CustomDetailRowMatchers
8
+
9
+ attr_reader :erb
10
+ attr_reader :recursion
11
+
12
+ before(:each) do
13
+ @counter = mock("counter")
14
+
15
+ @erb = ERB.new(File.read("lib/templates/test_numbers.html.erb"))
16
+ end
17
+
18
+ it "should just report on the number of tests when no errors or failures" do
19
+ @size = 4
20
+ @counter.stub!(:error_count).and_return(0)
21
+ @counter.stub!(:failure_count).and_return(0)
22
+
23
+ (process_erb/"p").each do |p|
24
+ (p/".test-count").inner_html.should match("4 tests")
25
+ (p/".green").inner_html.should match("all good")
26
+ (p/".yellow").should be_empty
27
+ (p/".red").should be_empty
28
+ end
29
+ end
30
+
31
+ it "should report the number of errors" do
32
+ @size = 17
33
+ @counter.should_receive(:error_count).at_least(:once).and_return(8)
34
+ @counter.stub!(:failure_count).and_return(0)
35
+
36
+ (process_erb/"p").each do |p|
37
+ (p/".test-count").inner_html.should match("17 tests")
38
+ (p/".green").should be_empty
39
+ (p/".yellow").inner_html.should match("8 errors")
40
+ (p/".red").should be_empty
41
+ end
42
+ end
43
+
44
+ it "should report the number of failures" do
45
+ @size = 34
46
+ @counter.stub!(:error_count).and_return(0)
47
+ @counter.should_receive(:failure_count).at_least(:once).and_return(14)
48
+
49
+ (process_erb/"p").each do |p|
50
+ (p/".test-count").inner_html.should match("34 tests")
51
+ (p/".green").should be_empty
52
+ (p/".yellow").should be_empty
53
+ (p/".red").inner_html.should match("14 failures")
54
+ end
55
+ end
56
+
57
+ it "should report the number of errors and failures" do
58
+ @size = 44
59
+ @counter.should_receive(:error_count).at_least(:once).and_return(5)
60
+ @counter.should_receive(:failure_count).at_least(:once).and_return(23)
61
+
62
+ (process_erb/"p").each do |p|
63
+ (p/".test-count").inner_html.should match("44 tests")
64
+ (p/".green").should be_empty
65
+ (p/".yellow").inner_html.should match("5 errors")
66
+ (p/".red").inner_html.should match("23 failures")
67
+ end
68
+ end
69
+
70
+ def process_erb
71
+ Hpricot(@erb.result(binding))
72
+ end
73
+
74
+ def size
75
+ @size
76
+ end
77
+
78
+ def counter
79
+ @counter
80
+ end
81
+
82
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ciat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy D. Frens
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-09-28 00:00:00 -05:00
13
+ date: 2009-10-30 00:00:00 -05:00
14
14
  default_executable:
15
15
  dependencies: []
16
16
 
@@ -22,53 +22,51 @@ extensions: []
22
22
 
23
23
  extra_rdoc_files:
24
24
  - README.rdoc
25
- - History.txt
26
25
  files:
27
- - History.txt
28
- - README.rdoc
29
- - Rakefile
30
- - ciat.gemspec
31
- - lib/ciat/version.rb
32
26
  - lib/ciat.rb
27
+ - lib/ciat/differs/html_differ.rb
28
+ - lib/ciat/erb_helpers.rb
29
+ - lib/ciat/feedback/composite.rb
30
+ - lib/ciat/feedback/feedback_counter.rb
31
+ - lib/ciat/feedback/html_feedback.rb
32
+ - lib/ciat/feedback/html_feedback_builder.rb
33
+ - lib/ciat/feedback/return_status.rb
34
+ - lib/ciat/feedback/standard_output.rb
35
+ - lib/ciat/io.rb
36
+ - lib/ciat/processors/basic_processing.rb
37
+ - lib/ciat/processors/compilation_interpreter.rb
38
+ - lib/ciat/processors/compiler.rb
39
+ - lib/ciat/processors/interpreter.rb
40
+ - lib/ciat/processors/java.rb
41
+ - lib/ciat/processors/parrot.rb
33
42
  - lib/ciat/rake_task.rb
34
- - lib/ciat/cargo.rb
35
- - lib/ciat/crate.rb
43
+ - lib/ciat/subresult.rb
36
44
  - lib/ciat/suite.rb
45
+ - lib/ciat/suite_builder.rb
37
46
  - lib/ciat/test.rb
38
- - lib/ciat/erb_helpers.rb
39
47
  - lib/ciat/test_element.rb
48
+ - lib/ciat/test_file.rb
49
+ - lib/ciat/test_result.rb
40
50
  - lib/ciat/traffic_light.rb
41
- - lib/ciat/processors/copy.rb
42
- - lib/ciat/processors/basic_processing.rb
43
- - lib/ciat/processors/compiler.rb
44
- - lib/ciat/processors/interpreter.rb
45
- - lib/ciat/processors/compilation_interpreter.rb
46
- - lib/ciat/compilers/java.rb
47
- - lib/ciat/executors/java.rb
48
- - lib/ciat/executors/parrot.rb
49
- - lib/ciat/differs/html_differ.rb
50
- - lib/ciat/feedback/standard_output.rb
51
- - lib/ciat/feedback/html_feedback.rb
52
- - lib/ciat/feedback/feedback_counter.rb
53
- - lib/ciat/feedback/composite.rb
54
- - lib/ciat/feedback/return_status.rb
55
51
  - lib/data/ciat.css
56
- - lib/data/prototype.js
57
52
  - lib/data/elements.yml
58
- - lib/templates/report.html.erb
59
- - lib/templates/group_header.html.erb
60
- - lib/templates/summary_row.html.erb
61
- - lib/templates/test_numbers.html.erb
53
+ - lib/data/prototype.js
62
54
  - lib/templates/detail_row.html.erb
63
55
  - lib/templates/detail_row/elements.html.erb
64
56
  - lib/templates/elements/diff.html.erb
65
57
  - lib/templates/elements/plain.html.erb
58
+ - lib/templates/group_header.html.erb
59
+ - lib/templates/report.html.erb
60
+ - lib/templates/summary_row.html.erb
61
+ - lib/templates/test_numbers.html.erb
62
+ - README.rdoc
66
63
  has_rdoc: true
67
64
  homepage: http://github.com/jdfrens/ciat
68
65
  licenses: []
69
66
 
70
67
  post_install_message:
71
68
  rdoc_options:
69
+ - --charset=UTF-8
72
70
  - --title
73
71
  - CIAT -- Compiler and Interpreter Acceptance Tester
74
72
  - --main
@@ -95,5 +93,29 @@ rubygems_version: 1.3.5
95
93
  signing_key:
96
94
  specification_version: 3
97
95
  summary: Acceptance tester for compilers and interpreters
98
- test_files: []
99
-
96
+ test_files:
97
+ - spec/ciat/erb_helpers_spec.rb
98
+ - spec/ciat/feedback/composite_spec.rb
99
+ - spec/ciat/feedback/feedback_counter_spec.rb
100
+ - spec/ciat/feedback/html_feedback_spec.rb
101
+ - spec/ciat/feedback/return_status_spec.rb
102
+ - spec/ciat/feedback/standard_output_spec.rb
103
+ - spec/ciat/processors/basic_processing_spec.rb
104
+ - spec/ciat/processors/java_spec.rb
105
+ - spec/ciat/processors/parrot_spec.rb
106
+ - spec/ciat/subresult_spec.rb
107
+ - spec/ciat/suite_builder_spec.rb
108
+ - spec/ciat/suite_spec.rb
109
+ - spec/ciat/test_element_spec.rb
110
+ - spec/ciat/test_file_spec.rb
111
+ - spec/ciat/test_spec.rb
112
+ - spec/ciat/traffic_light_spec.rb
113
+ - spec/ciat_spec.rb
114
+ - spec/spec_helper.rb
115
+ - spec/templates/detail_row/elements_html_erb_spec.rb
116
+ - spec/templates/detail_row_html_erb_spec.rb
117
+ - spec/templates/elements/diff_html_erb_spec.rb
118
+ - spec/templates/elements/plain_element_html_erb_spec.rb
119
+ - spec/templates/report_html_erb_spec.rb
120
+ - spec/templates/summary_row_html_erb_spec.rb
121
+ - spec/templates/test_numbers_html_erb_spec.rb
data/History.txt DELETED
@@ -1,96 +0,0 @@
1
- == 0.4.8 2009-
2
- * 1 minor feature
3
- * Library paths can be specified for parrot executor.
4
-
5
- == 0.4.7 2009-09-22
6
- * 3 major features
7
- * File names appear as title attributes for tests and elements in the
8
- HTML report.
9
- * Folders containing tests are grouped in the HTML report, and each
10
- group has a header consisting of the folder's path.
11
- * The CIAT::RakeTask class makes defining a rake task a bit cleaner.
12
-
13
- == 0.4.1 2009-04-29
14
- * 1 major feature (bug fix?)
15
- * If a test errors or fails, the Suite task will fail. This sets
16
- the command-line status appropriately.
17
-
18
- == 0.4.0 2009-04-20
19
- * 2 major features
20
- * All processors now need to read from a file and output to standard output
21
- and standard error.
22
- * All processors now handle command-line arguments.
23
-
24
- == 0.3.4 2009-04-05
25
- * 1 minor feature
26
- * Command-line feedback reports number of failures and errors.
27
-
28
- == 0.3.3 2009-04-01
29
- * 1 minor bug fix
30
- * Fixed file redirection for Java executor since sh doesn't support &>.
31
-
32
- == 0.3.2 2009-02-16
33
- * 1 minor enhancement
34
- * Some line number information in diffs.
35
- * 1 minor bug fix
36
- * in-Java interpreter uses diff output for failures.
37
-
38
- == 0.3.1 2009-02-16
39
- * 1 major bug fix
40
- * ACTUALLY added in-Java interpreter executor (missed file in gemspec).
41
-
42
- == 0.3.0 2009-02-15
43
- * 1 major enhancement:
44
- * Added in-Java interpreter executor.
45
-
46
- == 0.2.0 2008-10-26
47
-
48
- * 3 major enhancements:
49
- * Elements of a test files are now labeled for greater flexibility; error
50
- checking is done on the elements (missing, unused, etc.).
51
- * A test file can specify optional elements for a processor. Parrot
52
- executor uses "command line" for command-line arguments; it provides
53
- a default if not specified.
54
- * Formatting improvements to the HTML report.
55
- * 1 minor enhancement:
56
- * Java compiler redirects standard error to a file.
57
-
58
- == 0.1.1 2008-08-16
59
-
60
- * 1 major bug fix
61
- * If executor is not run (while compilation fails), its traffic light is
62
- unset; the standard output feedback now handles this case.
63
-
64
- == 0.1.0 2008-08-14
65
-
66
- * 2 major enhancements:
67
- * Generates a very useful HTML report, complete with side-by-side diffs.
68
- * Immediate feedback while tests are running ("."s, "F"s, and "E"s).
69
-
70
- == 0.0.4 2008-08-08
71
-
72
- * 2 major enhancements:
73
- * Flexible way to specified test files (including recursive search).
74
- * Executor triggered only if compilation phase is green.
75
- * minor
76
- * Internal renamings and restructuring.
77
-
78
- == 0.0.3 2008-08-02
79
-
80
- * 2 major enhancements:
81
- * Major refactoring of internals
82
- * Feedback mechanisms (for simple status reports, not failure/success yet) added
83
- * 1 modification:
84
- * Expecting .ciat as file extension of CIAT test files.
85
-
86
- == 0.0.2 2008-07-28
87
-
88
- * 1 major enhancement:
89
- * Actual RubyDocs!
90
-
91
- == 0.0.1 2008-07-28
92
-
93
- * 1 major enhancement:
94
- * Initial release
95
- * Runs tests over all *.txt files.
96
- * Slight abstraction for compiler and executor.
data/Rakefile DELETED
@@ -1,40 +0,0 @@
1
- require 'rake'
2
- require 'rake/clean'
3
- require 'rake/rdoctask'
4
- require 'spec/rake/spectask'
5
-
6
- task :default => :specs
7
-
8
- desc "Run all examples"
9
- Spec::Rake::SpecTask.new(:specs) do |t|
10
- t.spec_opts = ['--options', "spec/spec.opts"]
11
- t.spec_files = FileList['spec/**/*_spec.rb']
12
- end
13
-
14
- desc "Run all examples with rcov"
15
- Spec::Rake::SpecTask.new(:specs_with_rcov) do |t|
16
- t.spec_opts = ['--options', "spec/spec.opts"]
17
- t.spec_files = FileList['spec/**/*_spec.rb']
18
- t.rcov = true
19
- t.rcov_opts = ['--exclude', 'spec']
20
- end
21
-
22
- desc "Generate documentation for CIAT"
23
- Rake::RDocTask.new(:doc) do |t|
24
- t.rdoc_dir = 'doc'
25
- t.title = "CIAT"
26
- t.options << '--line-numbers' << '--inline-source'
27
- t.options << '--charset' << 'utf-8'
28
- t.rdoc_files.include('README.rdoc')
29
- t.rdoc_files.include('History.txt')
30
- t.rdoc_files.include('lib/**/*.rb')
31
- end
32
-
33
- desc "Make and install gem"
34
- task :gem => [:specs_with_rcov] do
35
- system "sudo gem uninstall ciat"
36
- system "rm *.gem"
37
- system "gem build ciat.gemspec"
38
- system "sudo gem install ciat*.gem"
39
- end
40
- CLOBBER << FileList['*.gem']
data/ciat.gemspec DELETED
@@ -1,53 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = "ciat"
3
- s.version = "0.4.8"
4
- s.summary = "Acceptance tester for compilers and interpreters"
5
- s.email = "jdfrens@gmail.com"
6
- s.homepage = "http://github.com/jdfrens/ciat"
7
- s.description = "CIAT (pronounced \"dog\") is a library of Ruby and rake code to make writing acceptance tests for compilers and interpreters easier (despite their implementation, source, and target languages)."
8
- s.has_rdoc = true
9
- s.authors = ["Jeremy D. Frens", "Mark Van Holstyn"]
10
- s.files =
11
- ["History.txt", "README.rdoc", "Rakefile", "ciat.gemspec",
12
- "lib/ciat/version.rb",
13
- "lib/ciat.rb",
14
- "lib/ciat/rake_task.rb",
15
- "lib/ciat/cargo.rb",
16
- "lib/ciat/crate.rb",
17
- "lib/ciat/suite.rb",
18
- "lib/ciat/test.rb",
19
- "lib/ciat/erb_helpers.rb",
20
- "lib/ciat/test_element.rb",
21
- "lib/ciat/traffic_light.rb",
22
- "lib/ciat/processors/copy.rb",
23
- "lib/ciat/processors/basic_processing.rb",
24
- "lib/ciat/processors/compiler.rb",
25
- "lib/ciat/processors/interpreter.rb",
26
- "lib/ciat/processors/compilation_interpreter.rb",
27
- "lib/ciat/compilers/java.rb",
28
- "lib/ciat/executors/java.rb",
29
- "lib/ciat/executors/parrot.rb",
30
- "lib/ciat/differs/html_differ.rb",
31
- "lib/ciat/feedback/standard_output.rb",
32
- "lib/ciat/feedback/html_feedback.rb",
33
- "lib/ciat/feedback/feedback_counter.rb",
34
- "lib/ciat/feedback/composite.rb",
35
- "lib/ciat/feedback/return_status.rb",
36
- "lib/data/ciat.css",
37
- "lib/data/prototype.js",
38
- "lib/data/elements.yml",
39
- "lib/templates/report.html.erb",
40
- "lib/templates/group_header.html.erb",
41
- "lib/templates/summary_row.html.erb",
42
- "lib/templates/test_numbers.html.erb",
43
- "lib/templates/detail_row.html.erb",
44
- "lib/templates/detail_row/elements.html.erb",
45
- "lib/templates/elements/diff.html.erb",
46
- "lib/templates/elements/plain.html.erb",
47
- ]
48
- s.extra_rdoc_files = ["README.rdoc", "History.txt"]
49
- s.rdoc_options <<
50
- '--title' << 'CIAT -- Compiler and Interpreter Acceptance Tester' <<
51
- '--main' << 'README.txt' <<
52
- '--line-numbers'
53
- end