concordion 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (298) hide show
  1. data/README +10 -0
  2. data/Rakefile.rb +69 -0
  3. data/html/classes/ConcordionBinder.html +176 -0
  4. data/html/classes/ConcordionBinder.src/M000042.html +18 -0
  5. data/html/classes/ConcordionBinder.src/M000043.html +23 -0
  6. data/html/classes/ConcordionBinder.src/M000044.html +20 -0
  7. data/html/classes/ConcordionCSS.html +146 -0
  8. data/html/classes/ConcordionCSS.src/M000100.html +18 -0
  9. data/html/classes/ConcordionCSS.src/M000101.html +20 -0
  10. data/html/classes/ConcordionCSSDecorator.html +242 -0
  11. data/html/classes/ConcordionCSSDecorator.src/M000011.html +25 -0
  12. data/html/classes/ConcordionCSSDecorator.src/M000012.html +18 -0
  13. data/html/classes/ConcordionCSSDecorator.src/M000013.html +18 -0
  14. data/html/classes/ConcordionCSSDecorator.src/M000014.html +18 -0
  15. data/html/classes/ConcordionCSSDecorator.src/M000015.html +18 -0
  16. data/html/classes/ConcordionCSSDecorator.src/M000016.html +18 -0
  17. data/html/classes/ConcordionCSSDecorator.src/M000017.html +20 -0
  18. data/html/classes/ConcordionCSSDecorator.src/M000018.html +29 -0
  19. data/html/classes/ConcordionConfigMethods.html +146 -0
  20. data/html/classes/ConcordionConfigMethods.src/M000123.html +30 -0
  21. data/html/classes/ConcordionConfigMethods.src/M000124.html +26 -0
  22. data/html/classes/ConcordionConstants.html +146 -0
  23. data/html/classes/ConcordionConstants.src/M000121.html +20 -0
  24. data/html/classes/ConcordionConstants.src/M000122.html +18 -0
  25. data/html/classes/ConcordionEnvironment.html +212 -0
  26. data/html/classes/ConcordionEnvironment.src/M000022.html +18 -0
  27. data/html/classes/ConcordionEnvironment.src/M000023.html +18 -0
  28. data/html/classes/ConcordionEnvironment.src/M000024.html +18 -0
  29. data/html/classes/ConcordionEnvironment.src/M000025.html +18 -0
  30. data/html/classes/ConcordionEnvironment.src/M000026.html +19 -0
  31. data/html/classes/ConcordionEnvironment.src/M000027.html +19 -0
  32. data/html/classes/ConcordionErrorCondition.html +179 -0
  33. data/html/classes/ConcordionErrorCondition.src/M000032.html +22 -0
  34. data/html/classes/ConcordionErrorCondition.src/M000033.html +25 -0
  35. data/html/classes/ConcordionInstrumenter.html +152 -0
  36. data/html/classes/ConcordionInstrumenter.src/M000045.html +30 -0
  37. data/html/classes/ConcordionInstrumenter.src/M000046.html +22 -0
  38. data/html/classes/ConcordionInternalTestMethods.html +213 -0
  39. data/html/classes/ConcordionInternalTestMethods.src/M000094.html +25 -0
  40. data/html/classes/ConcordionInternalTestMethods.src/M000095.html +23 -0
  41. data/html/classes/ConcordionInternalTestMethods.src/M000096.html +26 -0
  42. data/html/classes/ConcordionInternalTestMethods.src/M000097.html +29 -0
  43. data/html/classes/ConcordionInternalTestMethods.src/M000098.html +22 -0
  44. data/html/classes/ConcordionInternalTestMethods.src/M000099.html +18 -0
  45. data/html/classes/ConcordionInvoker.html +327 -0
  46. data/html/classes/ConcordionInvoker.src/M000058.html +18 -0
  47. data/html/classes/ConcordionInvoker.src/M000059.html +26 -0
  48. data/html/classes/ConcordionInvoker.src/M000060.html +23 -0
  49. data/html/classes/ConcordionInvoker.src/M000061.html +26 -0
  50. data/html/classes/ConcordionInvoker.src/M000062.html +27 -0
  51. data/html/classes/ConcordionInvoker.src/M000063.html +22 -0
  52. data/html/classes/ConcordionInvoker.src/M000064.html +25 -0
  53. data/html/classes/ConcordionInvoker.src/M000065.html +26 -0
  54. data/html/classes/ConcordionInvoker.src/M000066.html +18 -0
  55. data/html/classes/ConcordionInvoker.src/M000067.html +18 -0
  56. data/html/classes/ConcordionInvoker.src/M000068.html +18 -0
  57. data/html/classes/ConcordionInvoker.src/M000069.html +26 -0
  58. data/html/classes/ConcordionInvoker.src/M000070.html +35 -0
  59. data/html/classes/ConcordionLookaheadHandler.html +152 -0
  60. data/html/classes/ConcordionLookaheadHandler.src/M000028.html +18 -0
  61. data/html/classes/ConcordionLookaheadHandler.src/M000029.html +22 -0
  62. data/html/classes/ConcordionParseResult.html +369 -0
  63. data/html/classes/ConcordionParseResult.src/M000076.html +21 -0
  64. data/html/classes/ConcordionParseResult.src/M000077.html +18 -0
  65. data/html/classes/ConcordionParseResult.src/M000078.html +18 -0
  66. data/html/classes/ConcordionParseResult.src/M000079.html +18 -0
  67. data/html/classes/ConcordionParseResult.src/M000080.html +18 -0
  68. data/html/classes/ConcordionParseResult.src/M000081.html +18 -0
  69. data/html/classes/ConcordionParseResult.src/M000082.html +18 -0
  70. data/html/classes/ConcordionParseResult.src/M000083.html +18 -0
  71. data/html/classes/ConcordionParseResult.src/M000084.html +19 -0
  72. data/html/classes/ConcordionParseResult.src/M000085.html +18 -0
  73. data/html/classes/ConcordionParseResult.src/M000086.html +18 -0
  74. data/html/classes/ConcordionParseResult.src/M000087.html +21 -0
  75. data/html/classes/ConcordionParseResult.src/M000088.html +22 -0
  76. data/html/classes/ConcordionParseResult.src/M000089.html +22 -0
  77. data/html/classes/ConcordionParser.html +214 -0
  78. data/html/classes/ConcordionParser.src/M000002.html +21 -0
  79. data/html/classes/ConcordionParser.src/M000003.html +20 -0
  80. data/html/classes/ConcordionParser.src/M000004.html +20 -0
  81. data/html/classes/ConcordionParser.src/M000005.html +26 -0
  82. data/html/classes/ConcordionProcessor.html +176 -0
  83. data/html/classes/ConcordionProcessor.src/M000019.html +19 -0
  84. data/html/classes/ConcordionProcessor.src/M000020.html +22 -0
  85. data/html/classes/ConcordionProcessor.src/M000021.html +18 -0
  86. data/html/classes/ConcordionReader.html +144 -0
  87. data/html/classes/ConcordionReader.src/M000001.html +18 -0
  88. data/html/classes/ConcordionState.html +299 -0
  89. data/html/classes/ConcordionState.src/M000052.html +18 -0
  90. data/html/classes/ConcordionState.src/M000053.html +23 -0
  91. data/html/classes/ConcordionState.src/M000054.html +18 -0
  92. data/html/classes/ConcordionState.src/M000055.html +18 -0
  93. data/html/classes/ConcordionState.src/M000056.html +25 -0
  94. data/html/classes/ConcordionState.src/M000057.html +28 -0
  95. data/html/classes/ConcordionStringUtility.html +259 -0
  96. data/html/classes/ConcordionStringUtility.src/M000102.html +18 -0
  97. data/html/classes/ConcordionStringUtility.src/M000103.html +18 -0
  98. data/html/classes/ConcordionStringUtility.src/M000104.html +18 -0
  99. data/html/classes/ConcordionStringUtility.src/M000105.html +18 -0
  100. data/html/classes/ConcordionStringUtility.src/M000106.html +18 -0
  101. data/html/classes/ConcordionStringUtility.src/M000107.html +18 -0
  102. data/html/classes/ConcordionStringUtility.src/M000108.html +43 -0
  103. data/html/classes/ConcordionStringUtility.src/M000109.html +18 -0
  104. data/html/classes/ConcordionStringUtility.src/M000110.html +18 -0
  105. data/html/classes/ConcordionStringWriter.html +165 -0
  106. data/html/classes/ConcordionStringWriter.src/M000030.html +19 -0
  107. data/html/classes/ConcordionStringWriter.src/M000031.html +18 -0
  108. data/html/classes/ConcordionTestCase.html +220 -0
  109. data/html/classes/ConcordionTestCase.src/M000006.html +19 -0
  110. data/html/classes/ConcordionTestCase.src/M000007.html +19 -0
  111. data/html/classes/ConcordionTestCase.src/M000008.html +19 -0
  112. data/html/classes/ConcordionTestCase.src/M000009.html +18 -0
  113. data/html/classes/ConcordionTestCase.src/M000010.html +18 -0
  114. data/html/classes/ConcordionTestMethods.html +151 -0
  115. data/html/classes/ConcordionTestMethods.src/M000092.html +24 -0
  116. data/html/classes/ConcordionUtility.html +229 -0
  117. data/html/classes/ConcordionUtility.src/M000114.html +18 -0
  118. data/html/classes/ConcordionUtility.src/M000115.html +34 -0
  119. data/html/classes/ConcordionUtility.src/M000116.html +22 -0
  120. data/html/classes/ConcordionUtility.src/M000117.html +18 -0
  121. data/html/classes/ConcordionUtility.src/M000118.html +22 -0
  122. data/html/classes/ConcordionUtility.src/M000119.html +18 -0
  123. data/html/classes/ConcordionUtility.src/M000120.html +25 -0
  124. data/html/classes/ConcordionVerifier.html +219 -0
  125. data/html/classes/ConcordionVerifier.src/M000071.html +20 -0
  126. data/html/classes/ConcordionVerifier.src/M000072.html +20 -0
  127. data/html/classes/ConcordionVerifier.src/M000073.html +23 -0
  128. data/html/classes/ConcordionVerifier.src/M000074.html +22 -0
  129. data/html/classes/ConcordionVerifier.src/M000075.html +28 -0
  130. data/html/classes/ConcordionWriter.html +244 -0
  131. data/html/classes/ConcordionWriter.src/M000034.html +18 -0
  132. data/html/classes/ConcordionWriter.src/M000035.html +20 -0
  133. data/html/classes/ConcordionWriter.src/M000036.html +18 -0
  134. data/html/classes/ConcordionWriter.src/M000037.html +18 -0
  135. data/html/classes/ConcordionWriter.src/M000038.html +21 -0
  136. data/html/classes/ConcordionWriter.src/M000039.html +22 -0
  137. data/html/classes/ConcordionWriter.src/M000040.html +18 -0
  138. data/html/classes/ConcordionWriter.src/M000041.html +18 -0
  139. data/html/classes/FailConditionally.html +131 -0
  140. data/html/classes/FailConditionally.src/M000090.html +22 -0
  141. data/html/classes/GoldmasterTestCase.html +208 -0
  142. data/html/classes/GoldmasterTestCase.src/M000047.html +22 -0
  143. data/html/classes/GoldmasterTestCase.src/M000048.html +18 -0
  144. data/html/classes/GoldmasterTestCase.src/M000049.html +18 -0
  145. data/html/classes/GoldmasterTestCase.src/M000050.html +18 -0
  146. data/html/classes/GoldmasterTestCase.src/M000051.html +31 -0
  147. data/html/classes/LoaderHelper.html +138 -0
  148. data/html/classes/LoaderHelper.src/M000093.html +24 -0
  149. data/html/classes/PluralToSingularUtility.html +131 -0
  150. data/html/classes/PluralToSingularUtility.src/M000091.html +18 -0
  151. data/html/classes/SnakeCaseUtility.html +161 -0
  152. data/html/classes/SnakeCaseUtility.src/M000111.html +23 -0
  153. data/html/classes/SnakeCaseUtility.src/M000112.html +20 -0
  154. data/html/classes/SnakeCaseUtility.src/M000113.html +18 -0
  155. data/html/created.rid +1 -0
  156. data/html/files/README.html +123 -0
  157. data/html/files/lib/concordion_binder_rb.html +108 -0
  158. data/html/files/lib/concordion_constants_rb.html +101 -0
  159. data/html/files/lib/concordion_css_decorator_rb.html +109 -0
  160. data/html/files/lib/concordion_css_rb.html +101 -0
  161. data/html/files/lib/concordion_environment_rb.html +101 -0
  162. data/html/files/lib/concordion_error_condition_rb.html +108 -0
  163. data/html/files/lib/concordion_instrumenter_rb.html +101 -0
  164. data/html/files/lib/concordion_invoker_rb.html +109 -0
  165. data/html/files/lib/concordion_lookahead_handler_rb.html +101 -0
  166. data/html/files/lib/concordion_parse_result_rb.html +108 -0
  167. data/html/files/lib/concordion_parser_rb.html +110 -0
  168. data/html/files/lib/concordion_processor_rb.html +108 -0
  169. data/html/files/lib/concordion_rb.html +108 -0
  170. data/html/files/lib/concordion_reader_rb.html +108 -0
  171. data/html/files/lib/concordion_state_rb.html +112 -0
  172. data/html/files/lib/concordion_string_utility_rb.html +101 -0
  173. data/html/files/lib/concordion_string_writer_rb.html +101 -0
  174. data/html/files/lib/concordion_test_case_rb.html +119 -0
  175. data/html/files/lib/concordion_test_methods_rb.html +125 -0
  176. data/html/files/lib/concordion_utility_rb.html +109 -0
  177. data/html/files/lib/concordion_verifier_rb.html +108 -0
  178. data/html/files/lib/concordion_writer_rb.html +101 -0
  179. data/html/files/lib/goldmaster_test_case_rb.html +110 -0
  180. data/html/files/lib/loader_helper_rb.html +108 -0
  181. data/html/files/lib/rcor_rb.html +108 -0
  182. data/html/fr_class_index.html +54 -0
  183. data/html/fr_file_index.html +52 -0
  184. data/html/fr_method_index.html +150 -0
  185. data/html/index.html +24 -0
  186. data/html/rdoc-style.css +208 -0
  187. data/lib/concordion.rb +2 -0
  188. data/lib/concordion_binder.rb +24 -0
  189. data/lib/concordion_constants.rb +13 -0
  190. data/lib/concordion_css.rb +179 -0
  191. data/lib/concordion_css_decorator.rb +58 -0
  192. data/lib/concordion_environment.rb +27 -0
  193. data/lib/concordion_error_condition.rb +26 -0
  194. data/lib/concordion_instrumenter.rb +30 -0
  195. data/lib/concordion_invoker.rb +137 -0
  196. data/lib/concordion_lookahead_handler.rb +17 -0
  197. data/lib/concordion_parse_result.rb +72 -0
  198. data/lib/concordion_parser.rb +47 -0
  199. data/lib/concordion_processor.rb +25 -0
  200. data/lib/concordion_reader.rb +10 -0
  201. data/lib/concordion_state.rb +78 -0
  202. data/lib/concordion_string_utility.rb +97 -0
  203. data/lib/concordion_string_writer.rb +13 -0
  204. data/lib/concordion_test_case.rb +47 -0
  205. data/lib/concordion_test_methods.rb +132 -0
  206. data/lib/concordion_utility.rb +70 -0
  207. data/lib/concordion_verifier.rb +50 -0
  208. data/lib/concordion_writer.rb +43 -0
  209. data/lib/goldmaster_test_case.rb +55 -0
  210. data/lib/loader_helper.rb +16 -0
  211. data/lib/rcor.rb +3 -0
  212. data/nbproject/private/config.properties +0 -0
  213. data/nbproject/private/private.properties +4 -0
  214. data/nbproject/private/private.xml +4 -0
  215. data/nbproject/private/rake-d.txt +21 -0
  216. data/nbproject/project.properties +11 -0
  217. data/nbproject/project.xml +16 -0
  218. data/test-lib/single_row_result.rb +9 -0
  219. data/test-lib/user.rb +8 -0
  220. data/tests/basic_assert.html +5 -0
  221. data/tests/basic_assert_test.rb +9 -0
  222. data/tests/basic_set.html +11 -0
  223. data/tests/basic_set_test.rb +8 -0
  224. data/tests/basic_text.html +14 -0
  225. data/tests/basic_text_test.rb +23 -0
  226. data/tests/concordion/concordion_css_decorator_test.rb +28 -0
  227. data/tests/concordion/concordion_environment_test.rb +44 -0
  228. data/tests/concordion/concordion_parse_result_test.rb +51 -0
  229. data/tests/concordion/concordion_reader_test.rb +15 -0
  230. data/tests/concordion/concordion_state_test.rb +38 -0
  231. data/tests/concordion/concordion_string_writer_test.rb +13 -0
  232. data/tests/concordion/concordion_utility_test.rb +135 -0
  233. data/tests/concordion/concordion_verifier_test.rb +38 -0
  234. data/tests/concordion/concordion_writer_test.rb +26 -0
  235. data/tests/concordion/goldmaster_test_case_test.rb +24 -0
  236. data/tests/concordion.css +2 -0
  237. data/tests/failing.html +9 -0
  238. data/tests/failing_test.rb +22 -0
  239. data/tests/goldmasters/failing_with_subclass.html +6 -0
  240. data/tests/goldmasters/failing_with_subclass_goldmaster.html +170 -0
  241. data/tests/goldmasters/failing_with_subclass_test.rb +24 -0
  242. data/tests/goldmasters/goldmaster_assert_true_failing.html +5 -0
  243. data/tests/goldmasters/goldmaster_assert_true_failing_goldmaster.html +169 -0
  244. data/tests/goldmasters/goldmaster_assert_true_failing_test.rb +14 -0
  245. data/tests/goldmasters/goldmaster_failing.html +45 -0
  246. data/tests/goldmasters/goldmaster_failing_goldmaster.html +209 -0
  247. data/tests/goldmasters/goldmaster_failing_test.rb +37 -0
  248. data/tests/goldmasters/goldmaster_malformed.html +7 -0
  249. data/tests/goldmasters/goldmaster_malformed_goldmaster.html +171 -0
  250. data/tests/goldmasters/goldmaster_malformed_test.rb +11 -0
  251. data/tests/goldmasters/goldmaster_passing.html +5 -0
  252. data/tests/goldmasters/goldmaster_passing_goldmaster.html +169 -0
  253. data/tests/goldmasters/goldmaster_passing_test.rb +9 -0
  254. data/tests/goldmasters/goldmaster_table.html +46 -0
  255. data/tests/goldmasters/goldmaster_table_bug.html +12 -0
  256. data/tests/goldmasters/goldmaster_table_bug_goldmaster.html +176 -0
  257. data/tests/goldmasters/goldmaster_table_bug_test.rb +24 -0
  258. data/tests/goldmasters/goldmaster_table_goldmaster.html +210 -0
  259. data/tests/goldmasters/goldmaster_table_test.rb +17 -0
  260. data/tests/image.html +5 -0
  261. data/tests/image.jpg +0 -0
  262. data/tests/image_test.rb +9 -0
  263. data/tests/link_style_css.html +5 -0
  264. data/tests/link_style_css_test.rb +16 -0
  265. data/tests/lookahead_assert_true.html +25 -0
  266. data/tests/lookahead_assert_true_test.rb +17 -0
  267. data/tests/mixed.html +5 -0
  268. data/tests/mixed_test.rb +19 -0
  269. data/tests/nested_element_lookahead.html +9 -0
  270. data/tests/nested_element_lookahead_test.rb +8 -0
  271. data/tests/numbers.html +5 -0
  272. data/tests/numbers_test.rb +11 -0
  273. data/tests/processes_elements_in_sorted_order.html +12 -0
  274. data/tests/processes_elements_in_sorted_order_test.rb +13 -0
  275. data/tests/return_result.html +7 -0
  276. data/tests/return_result_test.rb +17 -0
  277. data/tests/tables/single_row_table.html +13 -0
  278. data/tests/tables/single_row_table_test.rb +9 -0
  279. data/tests/tables/table.html +28 -0
  280. data/tests/tables/table_test.rb +9 -0
  281. data/tests/tables/test_helper.rb +9 -0
  282. data/tests/tables/verify_rows.html +46 -0
  283. data/tests/tables/verify_rows_scsr.html +27 -0
  284. data/tests/tables/verify_rows_scsr_test.rb +17 -0
  285. data/tests/tables/verify_rows_simple.html +14 -0
  286. data/tests/tables/verify_rows_simple_test.rb +17 -0
  287. data/tests/tables/verify_rows_test.rb +16 -0
  288. data/tests/user-reported/apostrophe.html +7 -0
  289. data/tests/user-reported/apostrophe_test.rb +18 -0
  290. data/tests/user-reported/ariel_example.html +13 -0
  291. data/tests/user-reported/ariel_example_test.rb +36 -0
  292. data/tests/user-reported/attr_assert.html +7 -0
  293. data/tests/user-reported/attr_assert_test.rb +13 -0
  294. data/tests/user-reported/basic_assert_true.html +6 -0
  295. data/tests/user-reported/basic_assert_true_test.rb +15 -0
  296. data/tests/user-reported/no_parens.html +15 -0
  297. data/tests/user-reported/no_parens_test.rb +20 -0
  298. metadata +403 -0
@@ -0,0 +1,132 @@
1
+ # To change this template, choose Tools | Templates
2
+ # and open the template in the editor.
3
+ require 'concordion_utility'
4
+ require 'concordion_reader'
5
+ require 'concordion_parser'
6
+ require 'concordion_processor'
7
+ require 'concordion_parse_result'
8
+ require 'concordion_test_case'
9
+ require 'concordion_writer'
10
+ require 'concordion_environment'
11
+ require 'concordion'
12
+ require 'concordion_css_decorator'
13
+ require 'concordion_utility'
14
+
15
+
16
+ module ConcordionConfigMethods
17
+
18
+
19
+ def default_config
20
+ concordion = ConcordionState.new
21
+ parser = ConcordionParser.new(ConcordionReader.new, concordion)
22
+ decorator = ConcordionCSSDecorator.new
23
+ processor = ConcordionProcessor.new(concordion, decorator)
24
+ {
25
+ :parser => parser,
26
+ :writer => ConcordionWriter.new(ConcordionEnvironment.output_dir),
27
+ :concordion => concordion,
28
+ :decorator => decorator,
29
+ :processor => processor,
30
+ :write_goldmaster => false,
31
+ :css_type => ConcordionEnvironment.css_type
32
+ }
33
+ end
34
+
35
+ def bind_test_method_to(subclass, config)
36
+ subclass.class_eval do
37
+ define_method :test_spec do
38
+ filename = snake_cased_test_name(subclass.to_s)
39
+ parse_spec(filename,config)
40
+ failures = run_spec(filename, config)
41
+ report_spec(filename,config, failures)
42
+ end
43
+ end
44
+ subclass
45
+ end
46
+
47
+
48
+ end
49
+
50
+ module ConcordionInternalTestMethods
51
+ @@EXPECTED_FAILURE_COUNT = 0
52
+ include ConcordionUtility
53
+
54
+ def parse_spec(filename,config)
55
+ config[:parser].parse(filename)
56
+ assert_concordion_document(config)
57
+ if self.class.method_defined?(:css_type)
58
+ config[:decorator].add_concordion_css_link(config[:parser].root, config[:parser].html, css_type)
59
+ else
60
+ config[:decorator].add_concordion_css_link(config[:parser].root, config[:parser].html, config[:css_type])
61
+ end
62
+
63
+ end
64
+
65
+ def run_spec(filename, config)
66
+ failures = []
67
+ config[:parser].each_eligible_concordion_element do |elem|
68
+ failure = config[:processor].process(elem, self)
69
+ failures << failure unless failure.nil?
70
+ end
71
+ failures
72
+ end
73
+
74
+ def report_spec(filename, config, failures)
75
+ config[:decorator].add_css_file_to_output_dir(config[:writer], config[:css_type])
76
+
77
+ writer = config[:writer]
78
+ if self.class.method_defined?(:rcor_writer)
79
+ writer = rcor_writer()
80
+ end
81
+
82
+ outfilename = writer.calculate_filename_and_overwrite(config[:parser].root, filename)
83
+ assert_no_failures(outfilename, config, failures)
84
+ end
85
+
86
+ def assert_no_failures(outfilename, config, failures)
87
+ expected = @@EXPECTED_FAILURE_COUNT
88
+
89
+ if self.class.method_defined?(:expected_failure_count)
90
+ expected = expected_failure_count()
91
+ end
92
+
93
+ message = build_message "#{show_failures(failures)}\nWrote output to #{outfilename}.",
94
+ 'Actual failure count <?> did not match expected <?>.',
95
+ failures.size, expected
96
+ assert_block message do
97
+ failures.size == expected
98
+ end
99
+ end
100
+
101
+ def show_failures(failures)
102
+ rv = ""
103
+ failures.each_with_index do |failure, index|
104
+ rv += "[Error:#{index + 1}] #{failure}\n"
105
+ end
106
+ rv
107
+ end
108
+
109
+ def assert_concordion_document(config)
110
+ assert_equal "http://www.concordion.org/2007/concordion", config[:parser].html.get_attribute("xmlns:concordion")
111
+ end
112
+
113
+ end
114
+
115
+ module ConcordionTestMethods
116
+ include ConcordionInternalTestMethods
117
+ extend ConcordionConfigMethods
118
+
119
+ class << self
120
+ alias_method :original_included, :included
121
+ end
122
+
123
+ def self.included(cmod)
124
+ original_included(cmod)
125
+ conf = default_config
126
+ cm = class << cmod
127
+ include ConcordionConfigMethods
128
+ end
129
+
130
+ bind_test_method_to(cmod, conf)
131
+ end
132
+ end
@@ -0,0 +1,70 @@
1
+
2
+ require 'concordion_constants'
3
+ require 'concordion_string_utility'
4
+
5
+
6
+ module ConcordionUtility
7
+ include ConcordionConstants
8
+ include ConcordionStringUtility
9
+
10
+ def instrumentation(attr)
11
+ attr.split(":")[1]
12
+ end
13
+
14
+ def concordion_arguments(name)
15
+ return [] unless has_arguments?(name)
16
+ arg_string = nil
17
+ if name =~ /\(/
18
+ name_no_end_paren = name.gsub(")", '')
19
+ arg_string = name_no_end_paren.split("(")[1]
20
+ else
21
+
22
+ base = name.strip
23
+ if base =~ /=/
24
+ arg_string = nil
25
+ base = base.split("=")[1].strip
26
+ end
27
+ tokens = base.split(" ").compact
28
+ arg_string = tokens.slice(1, tokens.size - 1).join(" ")
29
+ end
30
+
31
+ arg_string.split(",").collect { |arg| arg.strip }
32
+ end
33
+ def concordion_variable_name(conc_call)
34
+ if has_property_reference?(conc_call)
35
+ return conc_call.split(".")[0].strip
36
+ end
37
+
38
+ conc_call.strip
39
+ end
40
+
41
+ def has_property_reference?(conc_call)
42
+ conc_call =~ /\./
43
+ end
44
+
45
+ def concordion_property_reference(conc_call)
46
+ if !has_property_reference?(conc_call)
47
+ return conc_call
48
+ end
49
+ idx = conc_call.index(".")
50
+ conc_call.slice(idx + 1, conc_call.length - idx).strip
51
+ end
52
+
53
+
54
+
55
+ def concordion_cmd_attr_exists?(elem)
56
+ !concordion_cmd_attr_for(elem).nil?
57
+ end
58
+
59
+ def concordion_cmd_attr_for(elem)
60
+ concordion_command_attributes.each {|attr|
61
+ instrumented_value = elem.get_attribute(attr)
62
+ if !instrumented_value.nil?
63
+ return attr
64
+ end
65
+ }
66
+
67
+ nil
68
+ end
69
+
70
+ end
@@ -0,0 +1,50 @@
1
+ require 'concordion_utility'
2
+
3
+ class ConcordionVerifier
4
+ include ConcordionUtility
5
+
6
+ @@ROW_REGEXP = /tr:nth\((\d+)\)/
7
+ attr_accessor :verification_variable
8
+ def initialize(concordion)
9
+ @concordion = concordion
10
+ @verification_variable = nil
11
+ @last_row = -1
12
+ end
13
+
14
+ def update_if_verify_command(cpr)
15
+ if cpr.is_verify_command?
16
+ @verification_variable = cpr.assignment
17
+ end
18
+ end
19
+
20
+ def update_verifier(idx)
21
+ return if verification_variable.nil?
22
+ arr = @concordion.get_variable(verification_variable)
23
+ index = idx < 1 ? 0 : idx - 1
24
+
25
+ value = arr[index]
26
+ @concordion.set_variable(singular(verification_variable), value)
27
+ end
28
+
29
+ def verification_variable=(value)
30
+ @verification_variable = value
31
+
32
+ unless @verification_variable.nil?
33
+ update_verifier(0)
34
+ end
35
+ end
36
+ def update_row(elem)
37
+ on_row = @@ROW_REGEXP.match(elem.css_path)
38
+ if on_row
39
+ current_row = on_row.captures[0]
40
+ if current_row != @last_row
41
+ update_verifier(current_row.to_i)
42
+ @last_row = current_row
43
+ end
44
+ else
45
+ @last_row = -1
46
+ end
47
+
48
+ end
49
+
50
+ end
@@ -0,0 +1,43 @@
1
+ class ConcordionWriter
2
+ @@DEFAULT = "."
3
+ def initialize(output_dir = @@DEFAULT)
4
+ @output_dir = output_dir.nil? ? @@DEFAULT : output_dir
5
+ end
6
+
7
+ def write(data, filename)
8
+ f = File.new(filename, "w")
9
+ f.puts data
10
+ f.close
11
+ end
12
+
13
+ def output_file_exists?(filename)
14
+ exists?(base_filename(filename))
15
+ end
16
+
17
+ def exists?(filename)
18
+ File.exists?(filename)
19
+ end
20
+
21
+ def delete_if_exists(filename)
22
+ if exists?(filename)
23
+ File.delete(filename)
24
+ end
25
+
26
+ end
27
+
28
+ def calculate_filename_and_overwrite(data, filename)
29
+ outfile = output_filename_for(filename)
30
+ delete_if_exists(outfile)
31
+ write(data, outfile)
32
+
33
+ outfile
34
+ end
35
+
36
+ def base_filename(filename)
37
+ File.join(@output_dir, filename)
38
+ end
39
+ def output_filename_for(name)
40
+ base_filename(name.sub(".html", "_test_output.html"))
41
+ end
42
+
43
+ end
@@ -0,0 +1,55 @@
1
+ require 'concordion_test_case'
2
+ require 'concordion_string_writer'
3
+
4
+ require 'diff/lcs'
5
+ module FailConditionally
6
+ def fail_if_write_still_enabled(cs, writer, data, name)
7
+ if cs.method_defined?(:write_goldmaster!)
8
+ writer.write(data, name)
9
+
10
+ raise RuntimeError.new("Disable write to goldmaster (erase write_goldmaster! in #{cs})")
11
+ end
12
+ end
13
+
14
+ end
15
+ class GoldmasterTestCase < ConcordionTestCase
16
+ include FailConditionally
17
+
18
+ def initialize(suite, conf = {})
19
+ @writer = ConcordionStringWriter.new
20
+
21
+ config = ConcordionTestCase.default_config.merge(conf)
22
+ @write_goldmaster = config[:write_goldmaster]
23
+ super(suite, config)
24
+ end
25
+
26
+ def rcor_writer
27
+ @writer
28
+ end
29
+ def test_spec
30
+ trivial
31
+ end
32
+
33
+ def writer
34
+ ConcordionWriter.new
35
+ end
36
+
37
+
38
+ def teardown
39
+ fail_if_write_still_enabled(self.class, writer, @writer.data, snake_cased_goldmaster_name(self.class.to_s))
40
+
41
+ unless is_trivial?
42
+ goldmaster = ConcordionReader.new.read(snake_cased_goldmaster_name(self.class.to_s))
43
+ assert @writer.data.size > 0
44
+
45
+ diffs = Diff::LCS.diff(@writer.data, goldmaster)
46
+ pos = diffs[0].entries[0].position
47
+ context_exp = goldmaster.slice(pos - 50, 100)
48
+ context_act = @writer.data.slice(pos - 50, 100)
49
+
50
+ assert_equal @writer.data, goldmaster, "First difference at #{pos} bytes into goldmaster:\n(#{context_exp}) goldmaster vs\n(#{context_act}) actual"
51
+ end
52
+
53
+ end
54
+
55
+ end
@@ -0,0 +1,16 @@
1
+ #
2
+ # To change this template, choose Tools | Templates
3
+ # and open the template in the editor.
4
+
5
+
6
+ module LoaderHelper
7
+ def path_for(filename)
8
+ return filename if File.exists?(filename)
9
+
10
+ $LOAD_PATH.each do |path|
11
+ candidate = "#{path}/#{filename}"
12
+ return candidate if File.exists?(candidate)
13
+ end
14
+ raise RuntimeError.new("could not find '#{filename}' on the system load path")
15
+ end
16
+ end
data/lib/rcor.rb ADDED
@@ -0,0 +1,3 @@
1
+
2
+
3
+ require 'concordion_test_case'
File without changes
@@ -0,0 +1,4 @@
1
+ file.reference.rcor-lib=C:\\rcor\\lib
2
+ file.reference.rcor-test-lib=C:\\rcor\\test-lib
3
+ file.reference.rcor-tests=C:\\rcor\\tests
4
+ platform.active=Ruby
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project-private xmlns="http://www.netbeans.org/ns/project-private/1">
3
+ <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
4
+ </project-private>
@@ -0,0 +1,21 @@
1
+ clean=Remove any temporary products.
2
+ clobber=Remove any generated file.
3
+ clobber_package=Remove package products
4
+ clobber_rcov=Remove rcov products for rcov
5
+ clobber_rdoc=Remove rdoc products
6
+ commit_prep=
7
+ default=
8
+ gem=Build the gem file concordion-0.9.8.gem
9
+ html=
10
+ html/index.html=
11
+ package=Build all the packages
12
+ pkg=
13
+ pkg/concordion-0.9.8=
14
+ pkg/concordion-0.9.8.gem=
15
+ pkg/concordion-0.9.8.tgz=
16
+ pkg/concordion-0.9.8.zip=
17
+ rcov=Analyze code coverage with tests
18
+ rdoc=Build the rdoc HTML Files
19
+ repackage=Force a rebuild of the package files
20
+ rerdoc=Force a rebuild of the RDOC files
21
+ test=Run tests
@@ -0,0 +1,11 @@
1
+ file.reference.rcor-lib=lib
2
+ file.reference.rcor-test-lib=test-lib
3
+ file.reference.rcor-tests=tests
4
+ javac.classpath=
5
+ main.file=
6
+ platform.active=Ruby
7
+ ruby.includejava=false
8
+ source.encoding=windows-1252
9
+ src.lib.dir=lib
10
+ src.test-lib.dir=test-lib
11
+ test.tests.dir=tests
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xmlns="http://www.netbeans.org/ns/project/1">
3
+ <type>org.netbeans.modules.ruby.rubyproject</type>
4
+ <configuration>
5
+ <data xmlns="http://www.netbeans.org/ns/ruby-project/1">
6
+ <name>rcor</name>
7
+ <source-roots>
8
+ <root id="src.test-lib.dir"/>
9
+ <root id="src.lib.dir"/>
10
+ </source-roots>
11
+ <test-roots>
12
+ <root id="test.tests.dir"/>
13
+ </test-roots>
14
+ </data>
15
+ </configuration>
16
+ </project>
@@ -0,0 +1,9 @@
1
+
2
+ class SingleRowResult
3
+ attr_accessor :alpha, :beta, :gamma
4
+ def initialize(args)
5
+ @alpha = args[0].upcase
6
+ @beta = args[1].upcase
7
+ @gamma = args[2].upcase
8
+ end
9
+ end
data/test-lib/user.rb ADDED
@@ -0,0 +1,8 @@
1
+
2
+ class User
3
+ attr_accessor :name, :other
4
+ def initialize(name, other)
5
+ @name = name
6
+ @other = other
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ <html xmlns:concordion="http://www.concordion.org/2007/concordion">
2
+ <body>
3
+ <b concordion:assertEquals="getGreeting()">Hello World!</b>
4
+ </body>
5
+ </html>
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+ require 'concordion_test_case'
3
+
4
+ class BasicAssertTest < ConcordionTestCase
5
+
6
+ def getGreeting
7
+ "Hello World!"
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ <html xmlns:concordion="http://www.concordion.org/2007/concordion">
2
+ <body>
3
+ Here's some text
4
+ <p concordion:set="#username">Chuck Norris</p>
5
+ <p concordion:set="#mnks">Monkeys</p>
6
+ <p concordion:set="#mnks">Monkeys</p>
7
+
8
+ <p concordion:assertEquals="greetingFor(#username)">Hello Chuck Norris, you nancy-boy.</p>
9
+ it should be in the output.
10
+ </body>
11
+ </html>
@@ -0,0 +1,8 @@
1
+ require 'test_helper'
2
+ require 'concordion_test_case'
3
+
4
+ class BasicSetTest < ConcordionTestCase
5
+ def greetingFor(name)
6
+ "Hello #{name}, you nancy-boy."
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ <html xmlns:concordion="http://www.concordion.org/2007/concordion">
2
+ <body>
3
+ <p concordion:execute="set_name(#TEXT)">No</p>
4
+ <p concordion:assertEquals="double_down()">NoNo</p>
5
+
6
+ <p concordion:execute="#result = return_arg(#TEXT)">Working Text</p>
7
+ <p concordion:assertEquals="#result">Working Text</p>
8
+
9
+ <p concordion:execute="#result = concat(#TEXT,#TEXT)">Working Text 2</p>
10
+ <p concordion:assertEquals="#result">Working Text 2:Working Text 2</p>
11
+
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,23 @@
1
+ require 'test_helper'
2
+ require 'concordion_test_case'
3
+
4
+ class BasicTextTest < ConcordionTestCase
5
+ def set_name(name)
6
+ @name = name
7
+ end
8
+
9
+ def return_arg(arg)
10
+ arg
11
+ end
12
+
13
+ def concat(a,b)
14
+ raise "second arg nil" if b.nil?
15
+ raise "first arg nil" if a.nil?
16
+
17
+ "#{a}:#{b}"
18
+ end
19
+
20
+ def double_down
21
+ "#{@name*2}"
22
+ end
23
+ end
@@ -0,0 +1,28 @@
1
+ require 'test_helper'
2
+ require 'concordion_css_decorator'
3
+ require 'rubygems'
4
+ require 'mocha'
5
+
6
+ class ConcordionCssDecoratorTest < Test::Unit::TestCase
7
+ def test_does_not_write_if_file_exists
8
+ writer = mock("writer")
9
+ writer.expects(:output_file_exists?).with("concordion.css").once.returns(true)
10
+
11
+ ConcordionCSSDecorator.new.add_css_file_to_output_dir(writer, :link)
12
+ end
13
+
14
+ def test_writes_if_file_does_not_exist
15
+ writer = mock("writer")
16
+ writer.expects(:output_file_exists?).with("concordion.css").once.returns(false)
17
+ writer.expects(:calculate_filename_and_overwrite).with(anything, "concordion.css").once
18
+
19
+ ConcordionCSSDecorator.new.add_css_file_to_output_dir(writer, :link)
20
+ end
21
+
22
+ def test_does_not_write_if_not_link_eg_inline
23
+ writer = mock("writer")
24
+ writer.expects(:output_file_exists?).with("concordion.css").once.returns(false)
25
+
26
+ ConcordionCSSDecorator.new.add_css_file_to_output_dir(writer, :inline)
27
+ end
28
+ end
@@ -0,0 +1,44 @@
1
+ require 'test_helper'
2
+ require 'concordion_environment'
3
+
4
+ class ConcordionEnvironmentTest < Test::Unit::TestCase
5
+
6
+ def test_output_dir
7
+ restore_env do
8
+ ENV[ConcordionEnvironment.output_dir_key] = nil
9
+ assert_equal ".", ConcordionEnvironment.output_dir
10
+ ENV[ConcordionEnvironment.output_dir_key] = "foo/bar"
11
+ assert_equal "foo/bar", ConcordionEnvironment.output_dir
12
+ end
13
+ end
14
+
15
+ def test_clean_list
16
+ restore_env do
17
+ ENV[ConcordionEnvironment.output_dir_key] = nil
18
+ assert_equal ["./*_test_output.html", "./concordion.css"], ConcordionEnvironment.clean_list
19
+ ENV[ConcordionEnvironment.output_dir_key] = "foo/bar"
20
+ assert_equal ["foo/bar/*_test_output.html", "foo/bar/concordion.css"], ConcordionEnvironment.clean_list
21
+ end
22
+
23
+ end
24
+
25
+ def test_css_type_defaults_to_inline
26
+ restore_env do
27
+ ENV[ConcordionEnvironment.css_type_key] = "link"
28
+ assert_equal :link, ConcordionEnvironment.css_type
29
+
30
+ ENV[ConcordionEnvironment.css_type_key] = nil
31
+ assert_equal :inline, ConcordionEnvironment.css_type
32
+
33
+ end
34
+
35
+ end
36
+
37
+ def restore_env
38
+ orig_dir = ENV[ConcordionEnvironment.output_dir_key]
39
+ orig_type = ENV[ConcordionEnvironment.css_type_key]
40
+ yield
41
+ ENV[ConcordionEnvironment.output_dir_key] = orig_dir
42
+ ENV[ConcordionEnvironment.css_type_key] = orig_type.to_s
43
+ end
44
+ end
@@ -0,0 +1,51 @@
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
@@ -0,0 +1,15 @@
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