ciat 0.4.9 → 0.4.10
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.
- data/lib/ciat.rb +1 -2
 - data/lib/ciat/{test_file.rb → ciat_file.rb} +21 -9
 - data/lib/ciat/erb_helpers.rb +6 -1
 - data/lib/ciat/feedback/feedback_counter.rb +11 -19
 - data/lib/ciat/feedback/return_status.rb +6 -2
 - data/lib/ciat/feedback/standard_output.rb +7 -2
 - data/lib/ciat/processors/compilation_interpreter.rb +20 -7
 - data/lib/ciat/processors/compiler.rb +38 -15
 - data/lib/ciat/processors/interpreter.rb +28 -7
 - data/lib/ciat/processors/java.rb +2 -8
 - data/lib/ciat/processors/parrot.rb +0 -3
 - data/lib/ciat/subresult.rb +14 -4
 - data/lib/ciat/subtest.rb +83 -0
 - data/lib/ciat/suite.rb +9 -9
 - data/lib/ciat/suite_builder.rb +5 -5
 - data/lib/ciat/test.rb +36 -28
 - data/lib/ciat/test_result.rb +2 -2
 - data/lib/ciat/traffic_light.rb +5 -14
 - data/lib/data/ciat.css +14 -2
 - data/lib/data/elements.yml +8 -2
 - data/lib/templates/detail_row.html.erb +10 -4
 - data/lib/templates/report.html.erb +5 -5
 - data/lib/templates/summary_row.html.erb +5 -3
 - data/spec/ciat/{test_file_spec.rb → ciat_file_spec.rb} +51 -19
 - data/spec/ciat/erb_helpers_spec.rb +8 -13
 - data/spec/ciat/feedback/feedback_counter_spec.rb +37 -57
 - data/spec/ciat/feedback/return_status_spec.rb +67 -61
 - data/spec/ciat/feedback/standard_output_spec.rb +21 -15
 - data/spec/ciat/processors/compilation_interpreter_spec.rb +12 -0
 - data/spec/ciat/processors/compiler_spec.rb +12 -0
 - data/spec/ciat/processors/interpreter_spec.rb +12 -0
 - data/spec/ciat/processors/java_spec.rb +0 -10
 - data/spec/ciat/processors/parrot_spec.rb +0 -10
 - data/spec/ciat/processors/shared_examples_for_element_names.rb +27 -0
 - data/spec/ciat/rake_task_spec.rb +65 -0
 - data/spec/ciat/subresult_spec.rb +13 -12
 - data/spec/ciat/subtest_spec.rb +199 -0
 - data/spec/ciat/suite_builder_spec.rb +17 -17
 - data/spec/ciat/suite_spec.rb +13 -13
 - data/spec/ciat/test_result_spec.rb +36 -0
 - data/spec/ciat/test_spec.rb +73 -83
 - data/spec/ciat/traffic_light_spec.rb +21 -31
 - data/spec/spec_helper.rb +16 -53
 - data/spec/templates/detail_row/elements_html_erb_spec.rb +3 -4
 - data/spec/templates/detail_row_html_erb_spec.rb +84 -23
 - data/spec/templates/elements/diff_html_erb_spec.rb +5 -3
 - data/spec/templates/summary_row_html_erb_spec.rb +21 -14
 - metadata +13 -7
 - data/lib/ciat/processors/basic_processing.rb +0 -55
 - data/spec/ciat/processors/basic_processing_spec.rb +0 -146
 
    
        data/lib/ciat/suite.rb
    CHANGED
    
    | 
         @@ -58,7 +58,7 @@ class CIAT::Suite 
     | 
|
| 
       58 
58 
     | 
    
         | 
| 
       59 
59 
     | 
    
         
             
              attr_reader :processors
         
     | 
| 
       60 
60 
     | 
    
         
             
              attr_reader :output_folder
         
     | 
| 
       61 
     | 
    
         
            -
              attr_reader : 
     | 
| 
      
 61 
     | 
    
         
            +
              attr_reader :ciat_files
         
     | 
| 
       62 
62 
     | 
    
         
             
              attr_reader :results
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
       64 
64 
     | 
    
         
             
              # Builds a suite of CIAT tests.  See the instructions above for possible
         
     | 
| 
         @@ -68,34 +68,34 @@ class CIAT::Suite 
     | 
|
| 
       68 
68 
     | 
    
         
             
                CIAT::Suite.new(
         
     | 
| 
       69 
69 
     | 
    
         
             
                  builder.build_processors,
         
     | 
| 
       70 
70 
     | 
    
         
             
                  builder.build_output_folder,
         
     | 
| 
       71 
     | 
    
         
            -
                  builder. 
     | 
| 
      
 71 
     | 
    
         
            +
                  builder.build_ciat_files,
         
     | 
| 
       72 
72 
     | 
    
         
             
                  builder.build_feedback)
         
     | 
| 
       73 
73 
     | 
    
         
             
              end
         
     | 
| 
       74 
74 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
              def initialize(processors, output_folder,  
     | 
| 
      
 75 
     | 
    
         
            +
              def initialize(processors, output_folder, ciat_files, feedback)
         
     | 
| 
       76 
76 
     | 
    
         
             
                @processors = processors
         
     | 
| 
       77 
77 
     | 
    
         
             
                @output_folder = output_folder
         
     | 
| 
       78 
     | 
    
         
            -
                @ 
     | 
| 
      
 78 
     | 
    
         
            +
                @ciat_files = ciat_files
         
     | 
| 
       79 
79 
     | 
    
         
             
                @feedback = feedback
         
     | 
| 
       80 
80 
     | 
    
         
             
              end
         
     | 
| 
       81 
81 
     | 
    
         | 
| 
       82 
82 
     | 
    
         
             
              # Returns the number of tests in the suite.
         
     | 
| 
       83 
83 
     | 
    
         
             
              def size
         
     | 
| 
       84 
     | 
    
         
            -
                 
     | 
| 
      
 84 
     | 
    
         
            +
                ciat_files.size
         
     | 
| 
       85 
85 
     | 
    
         
             
              end
         
     | 
| 
       86 
86 
     | 
    
         | 
| 
       87 
87 
     | 
    
         
             
              # Runs all of the tests in the suite, and returns the results.  The results
         
     | 
| 
       88 
88 
     | 
    
         
             
              # are also available through #results.
         
     | 
| 
       89 
89 
     | 
    
         
             
              def run
         
     | 
| 
       90 
90 
     | 
    
         
             
                @feedback.pre_tests(self)
         
     | 
| 
       91 
     | 
    
         
            -
                @results =  
     | 
| 
       92 
     | 
    
         
            -
                  map { | 
     | 
| 
      
 91 
     | 
    
         
            +
                @results = ciat_files.
         
     | 
| 
      
 92 
     | 
    
         
            +
                  map { |ciat_file| create_test(ciat_file) }.
         
     | 
| 
       93 
93 
     | 
    
         
             
                  map { |test| test.run }
         
     | 
| 
       94 
94 
     | 
    
         
             
                @feedback.post_tests(self)
         
     | 
| 
       95 
95 
     | 
    
         
             
                @results
         
     | 
| 
       96 
96 
     | 
    
         
             
              end
         
     | 
| 
       97 
97 
     | 
    
         | 
| 
       98 
     | 
    
         
            -
              def create_test( 
     | 
| 
       99 
     | 
    
         
            -
                CIAT::Test.new( 
     | 
| 
      
 98 
     | 
    
         
            +
              def create_test(ciat_file)
         
     | 
| 
      
 99 
     | 
    
         
            +
                CIAT::Test.new(ciat_file, @processors, @feedback)
         
     | 
| 
       100 
100 
     | 
    
         
             
              end
         
     | 
| 
       101 
101 
     | 
    
         
             
            end
         
     | 
    
        data/lib/ciat/suite_builder.rb
    CHANGED
    
    | 
         @@ -17,22 +17,22 @@ class CIAT::SuiteBuilder 
     | 
|
| 
       17 
17 
     | 
    
         
             
                options[:output_folder] || OUTPUT_FOLDER
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
              def  
     | 
| 
      
 20 
     | 
    
         
            +
              def build_ciat_files
         
     | 
| 
       21 
21 
     | 
    
         
             
                if options[:files]
         
     | 
| 
       22 
     | 
    
         
            -
                   
     | 
| 
      
 22 
     | 
    
         
            +
                  make_ciat_files(options[:files])
         
     | 
| 
       23 
23 
     | 
    
         
             
                else  
         
     | 
| 
       24 
24 
     | 
    
         
             
                  folder = options[:folder] || "ciat"
         
     | 
| 
       25 
25 
     | 
    
         
             
                  pattern = options[:pattern] || "*.ciat"
         
     | 
| 
       26 
     | 
    
         
            -
                   
     | 
| 
      
 26 
     | 
    
         
            +
                  make_ciat_files(Dir[File.join(folder, "**", pattern)])
         
     | 
| 
       27 
27 
     | 
    
         
             
                end
         
     | 
| 
       28 
28 
     | 
    
         
             
              end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
              def  
     | 
| 
      
 30 
     | 
    
         
            +
              def make_ciat_files(filenames)
         
     | 
| 
       31 
31 
     | 
    
         
             
                if filenames.empty?
         
     | 
| 
       32 
32 
     | 
    
         
             
                  raise IOError.new("no test files specified")
         
     | 
| 
       33 
33 
     | 
    
         
             
                end
         
     | 
| 
       34 
34 
     | 
    
         
             
                filenames.map do |filename|
         
     | 
| 
       35 
     | 
    
         
            -
                  CIAT:: 
     | 
| 
      
 35 
     | 
    
         
            +
                  CIAT::CiatFile.new(filename, build_output_folder)
         
     | 
| 
       36 
36 
     | 
    
         
             
                end
         
     | 
| 
       37 
37 
     | 
    
         
             
              end
         
     | 
| 
       38 
38 
     | 
    
         | 
    
        data/lib/ciat/test.rb
    CHANGED
    
    | 
         @@ -1,55 +1,63 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'set'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'ciat/test_result'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'ciat/subtest'
         
     | 
| 
       3 
4 
     | 
    
         
             
            require 'ciat/subresult'
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
            class CIAT::Test
         
     | 
| 
       6 
7 
     | 
    
         
             
              attr_reader :processors
         
     | 
| 
       7 
8 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
              def initialize( 
     | 
| 
       9 
     | 
    
         
            -
                @ 
     | 
| 
      
 9 
     | 
    
         
            +
              def initialize(ciat_file, processors, feedback) #:nodoc:
         
     | 
| 
      
 10 
     | 
    
         
            +
                @ciat_file = ciat_file
         
     | 
| 
       10 
11 
     | 
    
         
             
                @processors = processors
         
     | 
| 
       11 
12 
     | 
    
         
             
                @feedback = feedback
         
     | 
| 
       12 
13 
     | 
    
         
             
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
                
         
     | 
| 
      
 15 
     | 
    
         
            +
              def run
         
     | 
| 
      
 16 
     | 
    
         
            +
                CIAT::TestResult.new(@ciat_file, run_subtests)
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
       13 
18 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
              def  
     | 
| 
       15 
     | 
    
         
            -
                @ 
     | 
| 
      
 19 
     | 
    
         
            +
              def grouping
         
     | 
| 
      
 20 
     | 
    
         
            +
                @ciat_file.grouping
         
     | 
| 
       16 
21 
     | 
    
         
             
              end
         
     | 
| 
       17 
22 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
              def  
     | 
| 
       19 
     | 
    
         
            -
                 
     | 
| 
      
 23 
     | 
    
         
            +
              def run_subtests #:nodoc:
         
     | 
| 
      
 24 
     | 
    
         
            +
                subtests = make_subtests
         
     | 
| 
      
 25 
     | 
    
         
            +
                subresults = []
         
     | 
| 
      
 26 
     | 
    
         
            +
                until subtests.empty?
         
     | 
| 
      
 27 
     | 
    
         
            +
                  subtest = subtests.shift
         
     | 
| 
      
 28 
     | 
    
         
            +
                  subresults << subresult(subtest, subtest.process)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  if subtest.sad_path?
         
     | 
| 
      
 30 
     | 
    
         
            +
                    return subresults + remaining_subtests(subtests, unneeded)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
                  unless subresults.last.light.green?
         
     | 
| 
      
 33 
     | 
    
         
            +
                    return subresults + remaining_subtests(subtests, unset)
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
                subresults
         
     | 
| 
      
 37 
     | 
    
         
            +
              end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
              def remaining_subtests(subtests, light)
         
     | 
| 
      
 40 
     | 
    
         
            +
                subtests.map { |subtest| subresult(subtest, light) }
         
     | 
| 
       20 
41 
     | 
    
         
             
              end
         
     | 
| 
       21 
42 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
              def  
     | 
| 
       23 
     | 
    
         
            -
                CIAT:: 
     | 
| 
      
 43 
     | 
    
         
            +
              def unneeded
         
     | 
| 
      
 44 
     | 
    
         
            +
                CIAT::TrafficLight::UNNEEDED
         
     | 
| 
       24 
45 
     | 
    
         
             
              end
         
     | 
| 
       25 
46 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
              def  
     | 
| 
       27 
     | 
    
         
            -
                 
     | 
| 
      
 47 
     | 
    
         
            +
              def unset
         
     | 
| 
      
 48 
     | 
    
         
            +
                CIAT::TrafficLight::UNSET
         
     | 
| 
       28 
49 
     | 
    
         
             
              end
         
     | 
| 
       29 
50 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
              def  
     | 
| 
       31 
     | 
    
         
            -
                light = CIAT::TrafficLight::GREEN
         
     | 
| 
      
 51 
     | 
    
         
            +
              def make_subtests
         
     | 
| 
       32 
52 
     | 
    
         
             
                processors.map do |processor|
         
     | 
| 
       33 
     | 
    
         
            -
                   
     | 
| 
       34 
     | 
    
         
            -
                    light = processor.process(self)
         
     | 
| 
       35 
     | 
    
         
            -
                    subresult(processor, light)
         
     | 
| 
       36 
     | 
    
         
            -
                  else
         
     | 
| 
       37 
     | 
    
         
            -
                    subresult(processor)
         
     | 
| 
       38 
     | 
    
         
            -
                  end
         
     | 
| 
      
 53 
     | 
    
         
            +
                  CIAT::Subtest.new(@ciat_file, processor)
         
     | 
| 
       39 
54 
     | 
    
         
             
                end
         
     | 
| 
       40 
55 
     | 
    
         
             
              end
         
     | 
| 
       41 
56 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
              def subresult( 
     | 
| 
       43 
     | 
    
         
            -
                subresult = CIAT::Subresult.new( 
     | 
| 
      
 57 
     | 
    
         
            +
              def subresult(subtest, light)
         
     | 
| 
      
 58 
     | 
    
         
            +
                subresult = CIAT::Subresult.new(@ciat_file,
         
     | 
| 
      
 59 
     | 
    
         
            +
                  subtest.path_kind, light, subtest)
         
     | 
| 
       44 
60 
     | 
    
         
             
                @feedback.report_subresult(subresult)
         
     | 
| 
       45 
61 
     | 
    
         
             
                subresult
         
     | 
| 
       46 
62 
     | 
    
         
             
              end
         
     | 
| 
       47 
     | 
    
         
            -
              
         
     | 
| 
       48 
     | 
    
         
            -
              def element(*names)
         
     | 
| 
       49 
     | 
    
         
            -
                elements[names.compact.join("_").to_sym]
         
     | 
| 
       50 
     | 
    
         
            -
              end
         
     | 
| 
       51 
     | 
    
         
            -
              
         
     | 
| 
       52 
     | 
    
         
            -
              def element?(*names)
         
     | 
| 
       53 
     | 
    
         
            -
                elements.has_key?(names.compact.join("_").to_sym)
         
     | 
| 
       54 
     | 
    
         
            -
              end
         
     | 
| 
       55 
63 
     | 
    
         
             
            end
         
     | 
    
        data/lib/ciat/test_result.rb
    CHANGED
    
    
    
        data/lib/ciat/traffic_light.rb
    CHANGED
    
    | 
         @@ -1,8 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            class CIAT::TrafficLight
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
               
     | 
| 
       4 
     | 
    
         
            -
              
         
     | 
| 
       5 
     | 
    
         
            -
              def initialize(setting = :unset) #:nodoc:
         
     | 
| 
      
 3 
     | 
    
         
            +
              def initialize(setting) #:nodoc:
         
     | 
| 
       6 
4 
     | 
    
         
             
                @setting = setting
         
     | 
| 
       7 
5 
     | 
    
         
             
              end
         
     | 
| 
       8 
6 
     | 
    
         | 
| 
         @@ -10,6 +8,7 @@ class CIAT::TrafficLight 
     | 
|
| 
       10 
8 
     | 
    
         
             
              RED = CIAT::TrafficLight.new(:red)
         
     | 
| 
       11 
9 
     | 
    
         
             
              YELLOW = CIAT::TrafficLight.new(:yellow)
         
     | 
| 
       12 
10 
     | 
    
         
             
              UNSET = CIAT::TrafficLight.new(:unset)
         
     | 
| 
      
 11 
     | 
    
         
            +
              UNNEEDED = CIAT::TrafficLight.new(:unneeded)
         
     | 
| 
       13 
12 
     | 
    
         | 
| 
       14 
13 
     | 
    
         
             
              def unset?
         
     | 
| 
       15 
14 
     | 
    
         
             
                @setting == :unset
         
     | 
| 
         @@ -19,24 +18,16 @@ class CIAT::TrafficLight 
     | 
|
| 
       19 
18 
     | 
    
         
             
                @setting == :green
         
     | 
| 
       20 
19 
     | 
    
         
             
              end
         
     | 
| 
       21 
20 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
              def green! #:nodoc:
         
     | 
| 
       23 
     | 
    
         
            -
                @setting = :green unless yellow?
         
     | 
| 
       24 
     | 
    
         
            -
              end
         
     | 
| 
       25 
     | 
    
         
            -
              
         
     | 
| 
       26 
21 
     | 
    
         
             
              def yellow?
         
     | 
| 
       27 
22 
     | 
    
         
             
                @setting == :yellow
         
     | 
| 
       28 
23 
     | 
    
         
             
              end
         
     | 
| 
       29 
24 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
              def yellow! #:nodoc:
         
     | 
| 
       31 
     | 
    
         
            -
                @setting = :yellow
         
     | 
| 
       32 
     | 
    
         
            -
              end
         
     | 
| 
       33 
     | 
    
         
            -
              
         
     | 
| 
       34 
25 
     | 
    
         
             
              def red?
         
     | 
| 
       35 
26 
     | 
    
         
             
                @setting == :red
         
     | 
| 
       36 
27 
     | 
    
         
             
              end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
              def  
     | 
| 
       39 
     | 
    
         
            -
                @setting  
     | 
| 
      
 28 
     | 
    
         
            +
                
         
     | 
| 
      
 29 
     | 
    
         
            +
              def unneeded?
         
     | 
| 
      
 30 
     | 
    
         
            +
                @setting == :unneeded
         
     | 
| 
       40 
31 
     | 
    
         
             
              end
         
     | 
| 
       41 
32 
     | 
    
         | 
| 
       42 
33 
     | 
    
         
             
              def color
         
     | 
    
        data/lib/data/ciat.css
    CHANGED
    
    | 
         @@ -35,6 +35,18 @@ 
     | 
|
| 
       35 
35 
     | 
    
         
             
              margin: 0;
         
     | 
| 
       36 
36 
     | 
    
         
             
            }
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
            .details  
     | 
| 
       39 
     | 
    
         
            -
              margin:  
     | 
| 
      
 38 
     | 
    
         
            +
            .details table, .details p {
         
     | 
| 
      
 39 
     | 
    
         
            +
              margin-left: 10px;
         
     | 
| 
      
 40 
     | 
    
         
            +
            }
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            tr.details td {
         
     | 
| 
      
 43 
     | 
    
         
            +
              padding-bottom: 10px;
         
     | 
| 
      
 44 
     | 
    
         
            +
            }
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            .details h3 {
         
     | 
| 
      
 47 
     | 
    
         
            +
              margin: 20px 10px 10px 10px;
         
     | 
| 
      
 48 
     | 
    
         
            +
            }
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            .details h4 {
         
     | 
| 
      
 51 
     | 
    
         
            +
              margin: 10px;
         
     | 
| 
       40 
52 
     | 
    
         
             
            }
         
     | 
    
        data/lib/data/elements.yml
    CHANGED
    
    | 
         @@ -7,9 +7,12 @@ compilation: 
     | 
|
| 
       7 
7 
     | 
    
         
             
            compilation_generated:
         
     | 
| 
       8 
8 
     | 
    
         
             
              description: compilation
         
     | 
| 
       9 
9 
     | 
    
         
             
              template: plain
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
            compilation_error_generated:
         
     | 
| 
       11 
11 
     | 
    
         
             
              description: error from compilation
         
     | 
| 
       12 
12 
     | 
    
         
             
              template: plain
         
     | 
| 
      
 13 
     | 
    
         
            +
            compilation_error_diff:
         
     | 
| 
      
 14 
     | 
    
         
            +
              description: diff of error output
         
     | 
| 
      
 15 
     | 
    
         
            +
              template: diff
         
     | 
| 
       13 
16 
     | 
    
         
             
            compilation_diff:
         
     | 
| 
       14 
17 
     | 
    
         
             
              description: compilation diff
         
     | 
| 
       15 
18 
     | 
    
         
             
              template: diff
         
     | 
| 
         @@ -19,12 +22,15 @@ execution: 
     | 
|
| 
       19 
22 
     | 
    
         
             
            execution_generated:
         
     | 
| 
       20 
23 
     | 
    
         
             
              description: execution
         
     | 
| 
       21 
24 
     | 
    
         
             
              template: plain
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
      
 25 
     | 
    
         
            +
            execution_error_generated:
         
     | 
| 
       23 
26 
     | 
    
         
             
              description: error from execution
         
     | 
| 
       24 
27 
     | 
    
         
             
              template: plain
         
     | 
| 
       25 
28 
     | 
    
         
             
            execution_diff:
         
     | 
| 
       26 
29 
     | 
    
         
             
              description: execution diff
         
     | 
| 
       27 
30 
     | 
    
         
             
              template: diff
         
     | 
| 
      
 31 
     | 
    
         
            +
            execution_error_diff:
         
     | 
| 
      
 32 
     | 
    
         
            +
              description: execution error diff
         
     | 
| 
      
 33 
     | 
    
         
            +
              template: diff
         
     | 
| 
       28 
34 
     | 
    
         
             
            command_line:
         
     | 
| 
       29 
35 
     | 
    
         
             
              description: command-line arguments
         
     | 
| 
       30 
36 
     | 
    
         
             
              template: plain
         
     | 
| 
         @@ -1,10 +1,16 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            <tr  
     | 
| 
      
 1 
     | 
    
         
            +
            <tr id="details_<%= filename_to_id(result.filename) %>"
         
     | 
| 
      
 2 
     | 
    
         
            +
            		class="details" style="display:none">
         
     | 
| 
       2 
3 
     | 
    
         
             
              <td colspan="<%= result.subresults.size + 1 %>">
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
            	<% result.subresults.each do |subresult| %>
         
     | 
| 
       5 
     | 
    
         
            -
            	  <h3>Results from <%= subresult.processor.describe  
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 6 
     | 
    
         
            +
            	  <h3>Results from <%= subresult.processor.describe %> (<%= subresult.path_kind %> path)</h3>
         
     | 
| 
      
 7 
     | 
    
         
            +
            	
         
     | 
| 
      
 8 
     | 
    
         
            +
            		<% if subresult.light.unset? || subresult.light.unneeded? %>
         
     | 
| 
      
 9 
     | 
    
         
            +
            			<p>Not executed.</p>
         
     | 
| 
      
 10 
     | 
    
         
            +
            		<% else %>
         
     | 
| 
      
 11 
     | 
    
         
            +
            			<%= render "detail_row/elements", 
         
     | 
| 
      
 12 
     | 
    
         
            +
            				:elements => subresult.relevant_elements %>
         
     | 
| 
      
 13 
     | 
    
         
            +
            		<% end %>
         
     | 
| 
       8 
14 
     | 
    
         
             
            	<% end %>
         
     | 
| 
       9 
15 
     | 
    
         | 
| 
       10 
16 
     | 
    
         
             
            </tr>
         
     | 
| 
         @@ -27,11 +27,11 @@ 
     | 
|
| 
       27 
27 
     | 
    
         
             
              		</tr>
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
29 
     | 
    
         
             
              		<% results.each do |result| %>
         
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
      
 30 
     | 
    
         
            +
            				<% if new_grouping?(result) %>
         
     | 
| 
      
 31 
     | 
    
         
            +
            					<%= render "group_header", :result => result %>
         
     | 
| 
      
 32 
     | 
    
         
            +
            				<% end %>
         
     | 
| 
      
 33 
     | 
    
         
            +
            				<%= render "summary_row", :result => result %>
         
     | 
| 
      
 34 
     | 
    
         
            +
            				<%= render "detail_row", :result => result %>
         
     | 
| 
       35 
35 
     | 
    
         
             
              		<% end %>
         
     | 
| 
       36 
36 
     | 
    
         
             
              	</table>
         
     | 
| 
       37 
37 
     | 
    
         
             
            	</body>
         
     | 
| 
         @@ -1,11 +1,13 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            <tr class="summary">
         
     | 
| 
      
 1 
     | 
    
         
            +
            <tr id="summary_<%= filename_to_id(result.filename) %>" class="summary">
         
     | 
| 
       2 
2 
     | 
    
         
             
            	<td>
         
     | 
| 
       3 
     | 
    
         
            -
            	  <a href="#" 
     | 
| 
      
 3 
     | 
    
         
            +
            	  <a href="#"
         
     | 
| 
      
 4 
     | 
    
         
            +
            			onclick="$(this).up('tr').next().toggle(); return false;"
         
     | 
| 
      
 5 
     | 
    
         
            +
            			title="<%= result.filename %>">
         
     | 
| 
       4 
6 
     | 
    
         
             
            	  <%= result.element(:description).content %>
         
     | 
| 
       5 
7 
     | 
    
         
             
            	  </a>
         
     | 
| 
       6 
8 
     | 
    
         
             
              </td>
         
     | 
| 
       7 
9 
     | 
    
         
             
            	<% result.subresults.each do |subresult| %>
         
     | 
| 
       8 
     | 
    
         
            -
            	  <td class="<%= subresult.light. 
     | 
| 
      
 10 
     | 
    
         
            +
            	  <td class="<%= subresult.light.color %>">
         
     | 
| 
       9 
11 
     | 
    
         
             
            	    <%= light_to_word(subresult.light) %>
         
     | 
| 
       10 
12 
     | 
    
         
             
            	  </td>
         
     | 
| 
       11 
13 
     | 
    
         
             
            	<% end %>
         
     | 
| 
         @@ -1,10 +1,10 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require File.dirname(__FILE__) + '/../spec_helper.rb'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            describe CIAT:: 
     | 
| 
      
 3 
     | 
    
         
            +
            describe CIAT::CiatFile do
         
     | 
| 
       4 
4 
     | 
    
         
             
              before(:each) do
         
     | 
| 
       5 
5 
     | 
    
         
             
                File.should_receive(:exists?).with(anything).
         
     | 
| 
       6 
6 
     | 
    
         
             
                  any_number_of_times.and_return(true)
         
     | 
| 
       7 
     | 
    
         
            -
                @ 
     | 
| 
      
 7 
     | 
    
         
            +
                @ciat_file = CIAT::CiatFile.new(mock("filename"), mock("output folder"))
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              describe "processing test file" do
         
     | 
| 
         @@ -17,10 +17,10 @@ describe CIAT::TestFile do 
     | 
|
| 
       17 
17 
     | 
    
         
             
                    :e0 => mock("element 0"), :e1 => mock("element 1"), 
         
     | 
| 
       18 
18 
     | 
    
         
             
                    :e2 => mock("element 2") }
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
                  @ 
     | 
| 
       21 
     | 
    
         
            -
                  @ 
     | 
| 
       22 
     | 
    
         
            -
                  @ 
     | 
| 
       23 
     | 
    
         
            -
                  @ 
     | 
| 
      
 20 
     | 
    
         
            +
                  @ciat_file.should_receive(:split).and_return(raw_elements)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  @ciat_file.should_receive(:filename).with(:e0).and_return(filenames[0])
         
     | 
| 
      
 22 
     | 
    
         
            +
                  @ciat_file.should_receive(:filename).with(:e1).and_return(filenames[1])
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @ciat_file.should_receive(:filename).with(:e2).and_return(filenames[2])
         
     | 
| 
       24 
24 
     | 
    
         
             
                  CIAT::TestElement.should_receive(:new).
         
     | 
| 
       25 
25 
     | 
    
         
             
                    with(:e0, filenames[0], raw_elements[:e0]).and_return(elements[:e0])
         
     | 
| 
       26 
26 
     | 
    
         
             
                  CIAT::TestElement.should_receive(:new).
         
     | 
| 
         @@ -28,69 +28,101 @@ describe CIAT::TestFile do 
     | 
|
| 
       28 
28 
     | 
    
         
             
                  CIAT::TestElement.should_receive(:new).
         
     | 
| 
       29 
29 
     | 
    
         
             
                    with(:e2, filenames[2], raw_elements[:e2]).and_return(elements[:e2])
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
                  @ 
     | 
| 
      
 31 
     | 
    
         
            +
                  @ciat_file.process.should == elements
         
     | 
| 
       32 
32 
     | 
    
         
             
                end
         
     | 
| 
       33 
33 
     | 
    
         
             
              end
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
              describe "splitting a test file" do
         
     | 
| 
       36 
36 
     | 
    
         
             
                it "should split just a description" do
         
     | 
| 
       37 
37 
     | 
    
         
             
                  expect_file_content("description only\n")
         
     | 
| 
       38 
     | 
    
         
            -
                  @ 
     | 
| 
      
 38 
     | 
    
         
            +
                  @ciat_file.split.should == { :description => "description only\n" }
         
     | 
| 
       39 
39 
     | 
    
         
             
                end
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
                it "should split description and something else" do
         
     | 
| 
       42 
42 
     | 
    
         
             
                  expect_file_content("description\n", "==== tag\n", "content\n")
         
     | 
| 
       43 
     | 
    
         
            -
                  @ 
     | 
| 
      
 43 
     | 
    
         
            +
                  @ciat_file.split.should == { :description => "description\n", :tag => "content\n" }
         
     | 
| 
       44 
44 
     | 
    
         
             
                end
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
46 
     | 
    
         
             
                it "should split the test file" do
         
     | 
| 
       47 
47 
     | 
    
         
             
                  expect_file_content("d\n", "==== source\n", "s\n",
         
     | 
| 
       48 
48 
     | 
    
         
             
                    "==== compilation_expected \n", "p\n",
         
     | 
| 
       49 
49 
     | 
    
         
             
                    "==== output_expected\n", "o\n")
         
     | 
| 
       50 
     | 
    
         
            -
                  @ 
     | 
| 
      
 50 
     | 
    
         
            +
                  @ciat_file.split.should == { :description => "d\n",
         
     | 
| 
       51 
51 
     | 
    
         
             
                    :source => "s\n", :compilation_expected => "p\n", :output_expected => "o\n" }
         
     | 
| 
       52 
52 
     | 
    
         
             
                end
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
54 
     | 
    
         
             
                it "should allow spaces in element name" do
         
     | 
| 
       55 
55 
     | 
    
         
             
                  expect_file_content("description\n" , "==== element name\n", "content\n")
         
     | 
| 
       56 
     | 
    
         
            -
                  @ 
     | 
| 
      
 56 
     | 
    
         
            +
                  @ciat_file.split.should == {
         
     | 
| 
       57 
57 
     | 
    
         
             
                    :description => "description\n", :element_name => "content\n" }
         
     | 
| 
       58 
58 
     | 
    
         
             
                end
         
     | 
| 
       59 
59 
     | 
    
         | 
| 
       60 
60 
     | 
    
         
             
                def expect_file_content(*content)
         
     | 
| 
       61 
     | 
    
         
            -
                  @ 
     | 
| 
      
 61 
     | 
    
         
            +
                  @ciat_file.should_receive(:read).and_return(content)
         
     | 
| 
      
 62 
     | 
    
         
            +
                end
         
     | 
| 
      
 63 
     | 
    
         
            +
              end
         
     | 
| 
      
 64 
     | 
    
         
            +
              
         
     | 
| 
      
 65 
     | 
    
         
            +
              describe "processing elements" do
         
     | 
| 
      
 66 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 67 
     | 
    
         
            +
                  @elements = mock("elements")
         
     | 
| 
      
 68 
     | 
    
         
            +
                  @ciat_file.should_receive(:elements).and_return(@elements)
         
     | 
| 
      
 69 
     | 
    
         
            +
                end
         
     | 
| 
      
 70 
     | 
    
         
            +
                
         
     | 
| 
      
 71 
     | 
    
         
            +
                it "should return specified element" do
         
     | 
| 
      
 72 
     | 
    
         
            +
                  element = mock("element")
         
     | 
| 
      
 73 
     | 
    
         
            +
                
         
     | 
| 
      
 74 
     | 
    
         
            +
                  @elements.should_receive(:[]).with(:foo).and_return(element)
         
     | 
| 
      
 75 
     | 
    
         
            +
                
         
     | 
| 
      
 76 
     | 
    
         
            +
                  @ciat_file.element(:foo).should == element
         
     | 
| 
      
 77 
     | 
    
         
            +
                end
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                it "should return specified element with multi-word name" do
         
     | 
| 
      
 80 
     | 
    
         
            +
                  element = mock("element")
         
     | 
| 
      
 81 
     | 
    
         
            +
                
         
     | 
| 
      
 82 
     | 
    
         
            +
                  @elements.should_receive(:[]).with(:foo_bar_joe).and_return(element)
         
     | 
| 
      
 83 
     | 
    
         
            +
                
         
     | 
| 
      
 84 
     | 
    
         
            +
                  @ciat_file.element(:foo, :bar, :joe).should == element
         
     | 
| 
      
 85 
     | 
    
         
            +
                end
         
     | 
| 
      
 86 
     | 
    
         
            +
              
         
     | 
| 
      
 87 
     | 
    
         
            +
                it "should check to see if element exists" do
         
     | 
| 
      
 88 
     | 
    
         
            +
                  exists = mock("a boolean")
         
     | 
| 
      
 89 
     | 
    
         
            +
                
         
     | 
| 
      
 90 
     | 
    
         
            +
                  @elements.should_receive(:has_key?).
         
     | 
| 
      
 91 
     | 
    
         
            +
                    with(:foo_bar_joe).and_return(exists)
         
     | 
| 
      
 92 
     | 
    
         
            +
                
         
     | 
| 
      
 93 
     | 
    
         
            +
                  @ciat_file.element?(:foo, :bar, :joe).should == exists
         
     | 
| 
       62 
94 
     | 
    
         
             
                end
         
     | 
| 
       63 
95 
     | 
    
         
             
              end
         
     | 
| 
       64 
96 
     | 
    
         
             
            end
         
     | 
| 
       65 
97 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
            describe CIAT:: 
     | 
| 
      
 98 
     | 
    
         
            +
            describe CIAT::CiatFile, "generating actual file names" do
         
     | 
| 
       67 
99 
     | 
    
         
             
              before(:each) do
         
     | 
| 
       68 
100 
     | 
    
         
             
                File.should_receive(:exists?).with(anything).
         
     | 
| 
       69 
101 
     | 
    
         
             
                  any_number_of_times.and_return(true)
         
     | 
| 
       70 
102 
     | 
    
         
             
                @output_folder = "outie"
         
     | 
| 
       71 
     | 
    
         
            -
                @ 
     | 
| 
      
 103 
     | 
    
         
            +
                @ciat_file = CIAT::CiatFile.new("ciat/phile.ciat", @output_folder)
         
     | 
| 
       72 
104 
     | 
    
         
             
              end
         
     | 
| 
       73 
105 
     | 
    
         | 
| 
       74 
106 
     | 
    
         
             
              it "should return the original filename" do
         
     | 
| 
       75 
     | 
    
         
            -
                @ 
     | 
| 
      
 107 
     | 
    
         
            +
                @ciat_file.filename(:ciat).should == "ciat/phile.ciat"
         
     | 
| 
       76 
108 
     | 
    
         
             
              end
         
     | 
| 
       77 
109 
     | 
    
         | 
| 
       78 
110 
     | 
    
         
             
              it "should work with no modifiers" do
         
     | 
| 
       79 
     | 
    
         
            -
                @ 
     | 
| 
      
 111 
     | 
    
         
            +
                @ciat_file.filename().should == "outie/ciat/phile"
         
     | 
| 
       80 
112 
     | 
    
         
             
              end
         
     | 
| 
       81 
113 
     | 
    
         | 
| 
       82 
114 
     | 
    
         
             
              it "should work with multiple modifiers" do
         
     | 
| 
       83 
     | 
    
         
            -
                @ 
     | 
| 
      
 115 
     | 
    
         
            +
                @ciat_file.filename("one", "two", "three").should == "outie/ciat/phile_one_two_three"
         
     | 
| 
       84 
116 
     | 
    
         
             
              end
         
     | 
| 
       85 
117 
     | 
    
         
             
            end
         
     | 
| 
       86 
118 
     | 
    
         | 
| 
       87 
     | 
    
         
            -
            describe CIAT:: 
     | 
| 
      
 119 
     | 
    
         
            +
            describe CIAT::CiatFile, "constructor errors" do
         
     | 
| 
       88 
120 
     | 
    
         
             
              it "should complain about a missing file" do
         
     | 
| 
       89 
121 
     | 
    
         
             
                File.should_receive(:exists?).
         
     | 
| 
       90 
122 
     | 
    
         
             
                  with("does-not-exist.ciat").and_return(false)
         
     | 
| 
       91 
123 
     | 
    
         | 
| 
       92 
124 
     | 
    
         
             
                lambda {
         
     | 
| 
       93 
     | 
    
         
            -
                  CIAT:: 
     | 
| 
      
 125 
     | 
    
         
            +
                  CIAT::CiatFile.new("does-not-exist.ciat", nil)
         
     | 
| 
       94 
126 
     | 
    
         
             
                }.should raise_error(IOError)
         
     | 
| 
       95 
127 
     | 
    
         
             
              end
         
     | 
| 
       96 
128 
     | 
    
         
             
            end
         
     |