concordion 0.9.9.2 → 0.9.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. data/README +0 -0
  2. data/Rakefile.rb +25 -28
  3. data/documentation/index.html +88 -0
  4. data/documentation/p/rcor/wiki/Tutorial/index.html +75 -0
  5. data/lib/concordion/binder.rb +26 -0
  6. data/lib/concordion/constants.rb +15 -0
  7. data/lib/{concordion_css.rb → concordion/css.rb} +9 -7
  8. data/lib/concordion/css_decorator.rb +59 -0
  9. data/lib/concordion/environment.rb +28 -0
  10. data/lib/concordion/error_condition.rb +27 -0
  11. data/lib/concordion/instrumenter.rb +31 -0
  12. data/lib/concordion/invoker.rb +148 -0
  13. data/lib/concordion/loader_helper.rb +17 -0
  14. data/lib/concordion/lookahead_handler.rb +16 -0
  15. data/lib/concordion/parse_result.rb +74 -0
  16. data/lib/concordion/parser.rb +43 -0
  17. data/lib/concordion/processor.rb +24 -0
  18. data/lib/concordion/reader.rb +11 -0
  19. data/lib/concordion/state.rb +77 -0
  20. data/lib/concordion/string_utility.rb +104 -0
  21. data/lib/concordion/string_writer.rb +13 -0
  22. data/lib/concordion/test_methods.rb +130 -0
  23. data/lib/concordion/utility.rb +72 -0
  24. data/lib/concordion/verifier.rb +52 -0
  25. data/lib/concordion/writer.rb +52 -0
  26. data/lib/concordion_test_case.rb +4 -16
  27. data/lib/goldmaster_test_case.rb +4 -4
  28. data/ruby-concordion.tmproj +249 -0
  29. data/test/concordion/css_decorator_test.rb +28 -0
  30. data/test/concordion/environment_test.rb +46 -0
  31. data/test/concordion/invoker_test.rb +20 -0
  32. data/test/concordion/parse_result_test.rb +51 -0
  33. data/test/concordion/reader_test.rb +12 -0
  34. data/test/concordion/state_test.rb +41 -0
  35. data/test/concordion/string_writer_test.rb +10 -0
  36. data/test/concordion/utility_test.rb +142 -0
  37. data/test/concordion/verifier_test.rb +38 -0
  38. data/test/concordion/writer_test.rb +29 -0
  39. data/{tests → test}/concordion.css +0 -0
  40. data/{tests/concordion → test}/goldmaster_test_case_test.rb +2 -8
  41. data/{tests → test/spec}/basic_assert.html +0 -0
  42. data/{tests → test/spec}/basic_assert_test.rb +2 -2
  43. data/{tests → test/spec}/basic_set.html +0 -0
  44. data/{tests → test/spec}/basic_set_test.rb +0 -1
  45. data/{tests → test/spec}/basic_text.html +0 -0
  46. data/{tests → test/spec}/basic_text_test.rb +0 -1
  47. data/{tests → test/spec}/failing.html +0 -0
  48. data/{tests → test/spec}/failing_test.rb +0 -1
  49. data/{tests → test/spec}/goldmasters/failing_with_subclass.html +0 -0
  50. data/{tests → test/spec}/goldmasters/failing_with_subclass_goldmaster.html +0 -0
  51. data/{tests → test/spec}/goldmasters/failing_with_subclass_test.rb +2 -2
  52. data/{tests → test/spec}/goldmasters/goldmaster_assert_true_failing.html +0 -0
  53. data/{tests → test/spec}/goldmasters/goldmaster_assert_true_failing_goldmaster.html +0 -0
  54. data/{tests → test/spec}/goldmasters/goldmaster_assert_true_failing_test.rb +0 -0
  55. data/{tests → test/spec}/goldmasters/goldmaster_failing.html +0 -0
  56. data/{tests → test/spec}/goldmasters/goldmaster_failing_goldmaster.html +0 -0
  57. data/{tests → test/spec}/goldmasters/goldmaster_failing_test.rb +0 -2
  58. data/{tests → test/spec}/goldmasters/goldmaster_malformed.html +0 -0
  59. data/{tests → test/spec}/goldmasters/goldmaster_malformed_goldmaster.html +0 -0
  60. data/{tests → test/spec}/goldmasters/goldmaster_malformed_test.rb +0 -0
  61. data/{tests → test/spec}/goldmasters/goldmaster_passing.html +0 -0
  62. data/{tests → test/spec}/goldmasters/goldmaster_passing_goldmaster.html +0 -0
  63. data/{tests → test/spec}/goldmasters/goldmaster_passing_test.rb +0 -0
  64. data/{tests → test/spec}/goldmasters/goldmaster_table.html +0 -0
  65. data/{tests → test/spec}/goldmasters/goldmaster_table_bug.html +0 -0
  66. data/{tests → test/spec}/goldmasters/goldmaster_table_bug_goldmaster.html +0 -0
  67. data/{tests → test/spec}/goldmasters/goldmaster_table_bug_test.rb +0 -0
  68. data/{tests → test/spec}/goldmasters/goldmaster_table_goldmaster.html +0 -0
  69. data/{tests → test/spec}/goldmasters/goldmaster_table_test.rb +1 -0
  70. data/{tests → test/spec}/image.html +0 -0
  71. data/{tests → test/spec}/image.jpg +0 -0
  72. data/{tests → test/spec}/image_test.rb +2 -2
  73. data/{tests → test/spec}/link_style_css.html +0 -0
  74. data/{tests → test/spec}/link_style_css_test.rb +1 -6
  75. data/{tests → test/spec}/lookahead_assert_true.html +0 -0
  76. data/{tests → test/spec}/lookahead_assert_true_test.rb +0 -0
  77. data/{tests → test/spec}/mixed.html +0 -0
  78. data/test/spec/mixed_test.rb +13 -0
  79. data/{tests → test/spec}/nested_element_lookahead.html +0 -0
  80. data/{tests → test/spec}/nested_element_lookahead_test.rb +0 -0
  81. data/{tests → test/spec}/numbers.html +0 -0
  82. data/{tests → test/spec}/numbers_test.rb +0 -0
  83. data/{tests → test/spec}/processes_elements_in_sorted_order.html +0 -0
  84. data/{tests → test/spec}/processes_elements_in_sorted_order_test.rb +0 -0
  85. data/{tests → test/spec}/return_result.html +0 -0
  86. data/{tests → test/spec}/return_result_test.rb +0 -0
  87. data/test/spec/structure/maps_to_module.html +11 -0
  88. data/test/spec/structure/maps_to_module_test.rb +13 -0
  89. data/{tests → test/spec}/tables/single_row_table.html +0 -0
  90. data/{tests → test/spec}/tables/single_row_table_test.rb +0 -0
  91. data/{tests → test/spec}/tables/table.html +0 -0
  92. data/{tests → test/spec}/tables/table_test.rb +1 -0
  93. data/{tests → test/spec}/tables/test_helper.rb +3 -7
  94. data/{tests → test/spec}/tables/verify_rows.html +0 -0
  95. data/{tests → test/spec}/tables/verify_rows_scsr.html +0 -0
  96. data/{tests → test/spec}/tables/verify_rows_scsr_test.rb +2 -1
  97. data/{tests → test/spec}/tables/verify_rows_simple.html +0 -0
  98. data/{tests → test/spec}/tables/verify_rows_simple_test.rb +0 -0
  99. data/{tests → test/spec}/tables/verify_rows_test.rb +1 -0
  100. data/{tests → test/spec}/user-reported/apostrophe.html +0 -0
  101. data/{tests → test/spec}/user-reported/apostrophe_test.rb +0 -1
  102. data/{tests → test/spec}/user-reported/ariel_example.html +0 -0
  103. data/{tests → test/spec}/user-reported/ariel_example_test.rb +0 -0
  104. data/{tests → test/spec}/user-reported/attr_assert.html +0 -0
  105. data/{tests → test/spec}/user-reported/attr_assert_test.rb +0 -1
  106. data/{tests → test/spec}/user-reported/basic_assert_true.html +0 -0
  107. data/{tests → test/spec}/user-reported/basic_assert_true_test.rb +1 -2
  108. data/{tests → test/spec}/user-reported/rubyish.html +0 -0
  109. data/{tests → test/spec}/user-reported/rubyish_test.rb +0 -1
  110. data/test/test_helper.rb +11 -0
  111. metadata +131 -114
  112. data/lib/concordion_binder.rb +0 -24
  113. data/lib/concordion_constants.rb +0 -13
  114. data/lib/concordion_css_decorator.rb +0 -58
  115. data/lib/concordion_environment.rb +0 -27
  116. data/lib/concordion_error_condition.rb +0 -26
  117. data/lib/concordion_instrumenter.rb +0 -30
  118. data/lib/concordion_invoker.rb +0 -137
  119. data/lib/concordion_lookahead_handler.rb +0 -17
  120. data/lib/concordion_parse_result.rb +0 -72
  121. data/lib/concordion_parser.rb +0 -47
  122. data/lib/concordion_processor.rb +0 -25
  123. data/lib/concordion_reader.rb +0 -10
  124. data/lib/concordion_state.rb +0 -78
  125. data/lib/concordion_string_utility.rb +0 -97
  126. data/lib/concordion_string_writer.rb +0 -13
  127. data/lib/concordion_test_methods.rb +0 -132
  128. data/lib/concordion_utility.rb +0 -70
  129. data/lib/concordion_verifier.rb +0 -50
  130. data/lib/concordion_writer.rb +0 -43
  131. data/lib/loader_helper.rb +0 -16
  132. data/tests/concordion/concordion_css_decorator_test.rb +0 -28
  133. data/tests/concordion/concordion_environment_test.rb +0 -44
  134. data/tests/concordion/concordion_parse_result_test.rb +0 -51
  135. data/tests/concordion/concordion_reader_test.rb +0 -15
  136. data/tests/concordion/concordion_state_test.rb +0 -38
  137. data/tests/concordion/concordion_string_writer_test.rb +0 -13
  138. data/tests/concordion/concordion_utility_test.rb +0 -135
  139. data/tests/concordion/concordion_verifier_test.rb +0 -38
  140. data/tests/concordion/concordion_writer_test.rb +0 -26
  141. data/tests/mixed_test.rb +0 -19
@@ -1,51 +0,0 @@
1
- require 'test_helper'
2
- require 'concordion_parse_result'
3
- require 'rubygems'
4
- require 'mocha'
5
- class ConcordionParseResultTest < Test::Unit::TestCase
6
-
7
- def test_is_set_command
8
- assert ConcordionParseResult.new("set",nil,nil,nil).is_set_command?
9
- assert !ConcordionParseResult.new("asdf",nil,nil,nil).is_set_command?
10
- end
11
-
12
- def test_is_assert_image_command
13
- assert ConcordionParseResult.new("assert_image",nil,nil,nil).is_assert_image_command?
14
- assert !ConcordionParseResult.new("set",nil,nil,nil).is_assert_image_command?
15
- end
16
-
17
- def test_is_execute_command
18
- assert ConcordionParseResult.new("execute",nil,nil,nil).is_execute_command?
19
- assert !ConcordionParseResult.new("asdf",nil,nil,nil).is_execute_command?
20
- end
21
-
22
- def test_is_verify_command
23
- assert ConcordionParseResult.new("verifyrows",nil,nil,nil).is_verify_command?
24
- assert !ConcordionParseResult.new("monkeys",nil,nil,nil).is_verify_command?
25
- end
26
- def test_is_asserttrue_command
27
- assert ConcordionParseResult.new("asserttrue",nil,nil,nil).is_assert_true_command?
28
- assert !ConcordionParseResult.new("monkeys",nil,nil,nil).is_assert_true_command?
29
- end
30
-
31
- def test_image_location
32
- tag = mock("tag")
33
- tag.expects(:get_attribute).with('src').returns "foo"
34
- assert_equal "foo", ConcordionParseResult.new(nil,nil,nil, tag).image_location
35
- end
36
- def test_assignment
37
- assert_equal "#user", ConcordionParseResult.new("verifyrows"," #user = asdfasdf",nil,nil).assignment
38
- assert_equal "#bob", ConcordionParseResult.new("monkeys","#bob=asdf",nil,nil).assignment
39
- end
40
-
41
- def test_to_s
42
- assert_equal "Concordion command[], System under test method[#asdf], Tag Content[] Image Location[]", ConcordionParseResult.new(nil,"#asdf", nil,nil).to_s
43
- end
44
- def test_needs_dereference
45
- assert ConcordionParseResult.new(nil,"#asdf", nil,nil).needs_dereference?
46
- assert !ConcordionParseResult.new(nil,"asdf", nil,nil).needs_dereference?
47
- assert !ConcordionParseResult.new(nil,"as#df", nil,nil).needs_dereference?
48
- assert !ConcordionParseResult.new(nil,"#asdf = foo()", nil,nil).needs_dereference?
49
- end
50
-
51
- end
@@ -1,15 +0,0 @@
1
- # To change this template, choose Tools | Templates
2
- # and open the template in the editor.
3
-
4
- $:.unshift File.join(File.dirname(__FILE__),'..','lib')
5
-
6
- require 'test/unit'
7
- require 'concordion_reader'
8
-
9
- class ConcordionReaderTest < Test::Unit::TestCase
10
- def test_foo
11
- assert_raise RuntimeError do
12
- ConcordionReader.new.path_for("purple_monkey_dishwasher")
13
- end
14
- end
15
- end
@@ -1,38 +0,0 @@
1
- require 'test/unit'
2
- require 'test_helper'
3
- require 'concordion_state'
4
-
5
- class ConcordionStateTest < Test::Unit::TestCase
6
-
7
- def setup
8
- @concordion = ConcordionState.new
9
- @thingy = Thingy.new()
10
- end
11
-
12
- def test_text_variable
13
- assert_equal ConcordionState.TEXT_VAR, "#TEXT"
14
- end
15
- def test_set_variable
16
- @concordion.set_variable("#foo", "bar")
17
-
18
- assert_equal "bar", @concordion.get_variable("#foo")
19
- end
20
-
21
- def test_dereference
22
- @concordion.set_variable("#result", @thingy)
23
-
24
- assert_same @thingy, @concordion.dereference("#result")
25
- end
26
- def test_dereference_with_property
27
- @concordion.set_variable("#result", @thingy)
28
-
29
- assert_equal "bleh", @concordion.dereference("#result.prop")
30
- end
31
-
32
- class Thingy
33
- attr_accessor :prop
34
- def initialize
35
- @prop = "bleh"
36
- end
37
- end
38
- end
@@ -1,13 +0,0 @@
1
- # To change this template, choose Tools | Templates
2
- # and open the template in the editor.
3
-
4
- $:.unshift File.join(File.dirname(__FILE__),'..','lib')
5
-
6
- require 'test/unit'
7
- require 'concordion_string_writer'
8
-
9
- class ConcordionStringWriterTest < Test::Unit::TestCase
10
- def test_foo
11
- assert ConcordionStringWriter.new.output_file_exists?("this is a lie, i don't really exist, but thats ok for string writers")
12
- end
13
- end
@@ -1,135 +0,0 @@
1
- require 'test_helper'
2
- require 'concordion_utility'
3
-
4
- class ConcordionUtilityTest < Test::Unit::TestCase
5
- include ConcordionUtility
6
-
7
- def test_supported
8
- assert supported?('p')
9
- assert supported?("p")
10
- assert supported?("P")
11
- assert !supported?("R")
12
- end
13
-
14
- def test_snakeCase
15
- assert_equal "bob", snake_case("bob")
16
- assert_equal "bob", snake_case("Bob")
17
- assert_equal "camel_case", snake_case("CamelCase")
18
- assert_equal "camel_case_var", snake_case("camelCaseVar")
19
- end
20
-
21
-
22
- def test_snake_cased_test_name
23
- assert_equal "bob.html", snake_cased_test_name("bob")
24
- assert_equal "bob.html", snake_cased_test_name("Bob")
25
- assert_equal "bob.html", snake_cased_test_name("BobTest")
26
- assert_equal "bob_case.html", snake_cased_test_name("BobCaseTest")
27
- end
28
-
29
- def test_snake_cased_goldmaster_name
30
- assert_equal "bob_goldmaster.html", snake_cased_goldmaster_name("bob")
31
- assert_equal "bob_goldmaster.html", snake_cased_goldmaster_name("Bob")
32
- assert_equal "bob_goldmaster.html", snake_cased_goldmaster_name("BobTest")
33
- assert_equal "bob_case_goldmaster.html", snake_cased_goldmaster_name("BobCaseTest")
34
- end
35
-
36
- def test_conc_method_name_hard
37
- assert_equal "greeting=", concordion_method_name("#result = greeting=(#TEXT)")
38
- end
39
-
40
- def test_escapes_single_quotes
41
- assert_equal "A\\\\'s", escape_single_quotes("A's")
42
- end
43
-
44
- def test_conc_method_name_no_parens
45
- assert_equal "invoke", concordion_method_name("invoke")
46
- assert_equal "invoke", concordion_method_name("invoke #foo")
47
-
48
- assert_equal "foo", concordion_method_name("#baz = foo #asdf, #fdsa")
49
- assert_equal "greeting=", concordion_method_name("greeting= #TEXT")
50
- end
51
-
52
- def test_conc_method_name
53
- assert_equal "invoke", concordion_method_name("invoke()")
54
- assert_equal "invoke", concordion_method_name("invoke(")
55
- assert_equal "invoke", concordion_method_name("invoke")
56
- assert_equal "bleh", concordion_method_name("bleh(foo,bar)")
57
- assert_equal "bleh", concordion_method_name("bleh ( foo , bar)")
58
- assert_equal "foo", concordion_method_name("#baz = foo ( #asdf, #fdsa)")
59
- assert_equal "greeting=", concordion_method_name("greeting=(#TEXT)")
60
- end
61
-
62
- def test_conc_var_name_no_parens
63
- assert_equal "#result", concordion_variable_name("#result.first")
64
- end
65
- def test_conc_var_name
66
- assert_equal "#result", concordion_variable_name("#result.first()")
67
- assert_equal "#res", concordion_variable_name(" #res ")
68
-
69
- end
70
-
71
- def test_is_direct_method_call
72
- assert is_direct_method_call?("invoke")
73
- assert !is_direct_method_call?("invoke(#foo,#bar)")
74
-
75
- end
76
- def test_has_args_no_parens
77
- assert !has_arguments?("invoke")
78
- assert has_arguments?("invoke #foo")
79
- assert has_arguments?("invoke #foo, #bar")
80
-
81
- end
82
-
83
- def test_has_args
84
- assert has_arguments?("invoke(#foo,#bar)")
85
- assert has_arguments?("invoke(#foo)")
86
- assert !has_arguments?("invoke()")
87
- end
88
-
89
- def test_conc_args_no_parens
90
- assert_equal [], concordion_arguments("invoke")
91
- assert_equal ["#foo","#bar"], concordion_arguments("bleh #foo,#bar")
92
- assert_equal ["#foo","#bar"], concordion_arguments("bleh #foo , #bar ")
93
- assert_equal ["#foo","#bar"], concordion_arguments("#asdf = bleh #foo , #bar ")
94
-
95
- end
96
- def test_conc_args
97
- assert_equal [], concordion_arguments("invoke()")
98
- assert_equal ["#foo","#bar"], concordion_arguments("bleh(#foo,#bar)")
99
- assert_equal ["#foo","#bar"], concordion_arguments("bleh ( #foo , #bar )")
100
- assert_equal ["#foo","#bar"], concordion_arguments("#asdf = bleh ( #foo , #bar )")
101
- end
102
-
103
- def test_conc_assignment_no_parens
104
- assert_equal "#foo", concordion_assignment(" #foo = getResult ")
105
- end
106
-
107
- def test_conc_assignment
108
- assert_equal "#foo", concordion_assignment(" #foo = getResult() ")
109
- assert_equal "#for", concordion_assignment("#for=")
110
- end
111
- def test_has_assignment
112
- assert has_assignment?("=")
113
- assert !has_assignment?("")
114
- end
115
-
116
- def test_has_property_ref
117
- assert has_property_reference?("#res.foo")
118
- assert !has_property_reference?("#res")
119
-
120
- end
121
-
122
- def test_property_ref
123
- assert_equal "#foo", concordion_property_reference("#foo")
124
- assert_equal "bar", concordion_property_reference(" #foo.bar ")
125
- assert_equal "bar.baz", concordion_property_reference("#for.bar.baz")
126
-
127
- end
128
-
129
- def test_singular
130
- assert_equal "bar", singular("bars")
131
- assert_equal "foo", singular("foo")
132
- end
133
-
134
-
135
- end
@@ -1,38 +0,0 @@
1
- require 'test_helper'
2
- require 'concordion'
3
- require 'concordion_verifier'
4
-
5
- class ConcordionVerifierTest < Test::Unit::TestCase
6
-
7
- def setup
8
- @concordion = ConcordionState.new
9
- @verifier = ConcordionVerifier.new(@concordion)
10
- end
11
-
12
-
13
-
14
- def test_update_does_not_blow_up_if_verification_variable_unset
15
- @verifier.verification_variable = nil
16
- @verifier.update_verifier(1)
17
- end
18
-
19
- def test_update_verification
20
- assert @concordion.get_variable("#user").nil?
21
- @concordion.set_variable("#users", ["A", "B", "C"])
22
- @verifier.verification_variable = "#users"
23
- @verifier.update_verifier(2) # will be one larger because of the header row
24
-
25
- assert_equal "B", @concordion.get_variable("#user")
26
- end
27
-
28
-
29
- def test_update_verification_automatically_sets_to_zero
30
- assert @concordion.get_variable("#user").nil?
31
- @concordion.set_variable("#users", ["A", "B", "C"])
32
- @verifier.verification_variable = "#users"
33
-
34
- assert_equal "A", @concordion.get_variable("#user")
35
- end
36
-
37
-
38
- end
@@ -1,26 +0,0 @@
1
- require 'test_helper'
2
- require 'rubygems'
3
- require 'mocha'
4
- require 'concordion_writer'
5
- class ConcordionWriterTest < Test::Unit::TestCase
6
- def test_output_file_name
7
-
8
- assert_equal "./bleh_test_output.html",
9
- ConcordionWriter.new.output_filename_for("bleh.html")
10
- assert_equal "./bleh_test_output.html",
11
- ConcordionWriter.new(nil).output_filename_for("bleh.html")
12
- assert_equal "foo/bleh_test_output.html",
13
- ConcordionWriter.new("foo").output_filename_for("bleh.html")
14
-
15
-
16
- end
17
-
18
- def test_output_file_exists
19
- File.expects(:exists?).with("foo/output.css").returns(true)
20
- File.expects(:exists?).with("foo/missing").returns(false)
21
-
22
- assert ConcordionWriter.new("foo").output_file_exists?("output.css")
23
- assert !ConcordionWriter.new("foo").output_file_exists?("missing")
24
- end
25
-
26
- end
data/tests/mixed_test.rb DELETED
@@ -1,19 +0,0 @@
1
- # To change this template, choose Tools | Templates
2
- # and open the template in the editor.
3
-
4
- $:.unshift File.join(File.dirname(__FILE__),'..','lib')
5
-
6
- require 'test/unit'
7
-
8
- require 'concordion_test_methods'
9
-
10
- class MixedTest < Test::Unit::TestCase
11
- include ConcordionTestMethods
12
-
13
- def easy
14
- "as pie"
15
- end
16
- def test_foo
17
- assert_equal "foo", "foo"
18
- end
19
- end