The Trunk: Tests-mt.451.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Tests-mt.451.mcz

commits-2
Marcel Taeumel uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-mt.451.mcz

==================== Summary ====================

Name: Tests-mt.451
Author: mt
Time: 14 April 2021, 10:38:45.375489 am
UUID: 2cef30f0-b2f4-b742-8105-48ecd3ec8650
Ancestors: Tests-nice.450

Adds commentary to CompilerExceptionsTest to explain how the "tests spec" for simulated user interactions look like.

=============== Diff against Tests-nice.450 ===============

Item was changed:
  ----- Method: CompilerExceptionsTest>>compiling:shouldRaise:andSelect:testing: (in category 'private') -----
  compiling: sourceCode shouldRaise: exceptionClass andSelect: selectionMatch testing: tests
+ "Test behavior of the compiler for the given sourceCode and expected an exception of kind exceptionClass. Other arguments:
+ * selectionMatch is used to check the selection of the source text that is active when an exception has occured. Can be a text, an interval, or a predicate block. See #assertSelection:.
+ * tests is an array of associations representing pairs of reactions (key) to the exception and the assertion (value) that should be run afterward.
+ * The key can be a boolean for answering yes/no dialogs, a string for selecting a named option from a dialog window, or a one-arg block to handle the occuring exception in a different way (see #handlerBlockFor:).
+ * The value can be either a string that will be compared to the final compiler source code or a custom assertion block that will be evaluated after the compilation has terminated (see #testBlockFor:)."
 
  | referenceTest |
  referenceTest := [] -> [].
  (tests copyWithFirst: referenceTest) associationsDo: [:test |
  self
  should: [self compile: sourceCode]
  raise: exceptionClass
  thenDo: [:exception |
  self assertSelection: selectionMatch.
  previousSelection := self selectionInterval.
  (self handlerBlockFor: test key) cull: exception].
  (self testBlockFor: test value) value].!