The Inbox: KernelTests-ct.374.mcz

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

The Inbox: KernelTests-ct.374.mcz

commits-2
Christoph Thiede uploaded a new version of KernelTests to project The Inbox:
http://source.squeak.org/inbox/KernelTests-ct.374.mcz

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

Name: KernelTests-ct.374
Author: ct
Time: 9 January 2020, 3:45:07.818555 pm
UUID: a7466380-609b-8146-b983-af77736d55f0
Ancestors: KernelTests-nice.373

Tests #haltOnce and #haltOnceIf:. Refactors tests for #haltIf:. Complements Kernel-ct.1294.

=============== Diff against KernelTests-nice.373 ===============

Item was added:
+ ----- Method: ObjectTest>>resetHaltOnceAfter: (in category 'running') -----
+ resetHaltOnceAfter: aBlock
+
+ | outerState |
+ outerState := self haltOnceEnabled.
+ ^ aBlock ensure: [
+ outerState
+ ifTrue: [self setHaltOnce]
+ ifFalse: [self clearHaltOnce] ]!

Item was added:
+ ----- Method: ObjectTest>>shouldHalt: (in category 'asserting') -----
+ shouldHalt: aBlock
+
+ ^ self
+ should: aBlock
+ raise: Halt!

Item was added:
+ ----- Method: ObjectTest>>shouldntHalt: (in category 'asserting') -----
+ shouldntHalt: aBlock
+
+ ^ self
+ shouldnt: aBlock
+ raise: Halt!

Item was changed:
+ ----- Method: ObjectTest>>testHaltIf (in category 'tests - debugging') -----
- ----- Method: ObjectTest>>testHaltIf (in category 'tests - testing') -----
  testHaltIf
 
+ self shouldHalt: [self haltIf: true].
+ self shouldntHalt: [self haltIf: false].
- self should: [self haltIf: true] raise: Halt.
- self haltIf: false.
 
+ self shouldHalt: [self haltIf: [true]].
+ self shouldntHalt: [self haltIf: [false]].
- self should: [self haltIf: [true]] raise: Halt.
- self haltIf: [false].
 
+ self shouldHalt: [self haltIf: #testHaltIf].
+ self shouldntHalt: [self haltIf: #teadfasdfltIf].
- self should: [self haltIf: #testHaltIf.] raise: Halt.
- self haltIf: #teadfasdfltIf.
 
+ self shouldHalt: [self a].
+ self shouldntHalt: [self a1].
- self should: [self a] raise: Halt.
- self a1.
 
+ self shouldHalt: [self haltIf: [:o | o class = self class]].
+ self shouldntHalt: [self haltIf: [:o | o class ~= self class]].
- self should: [self haltIf: [:o | o class = self class]] raise: Halt.
- self haltIf: [:o | o class ~= self class].
  !

Item was added:
+ ----- Method: ObjectTest>>testHaltOnce (in category 'tests - debugging') -----
+ testHaltOnce
+
+ self resetHaltOnceAfter: [
+ self setHaltOnce.
+ self assert: [self haltOnceEnabled].
+ self shouldHalt: [self haltOnce].
+ self deny: [self haltOnceEnabled].
+ self shouldntHalt: [self haltOnce].
+
+ self setHaltOnce.
+ self assert: [self haltOnceEnabled].
+ self clearHaltOnce.
+ self deny: [self haltOnceEnabled].
+ self shouldntHalt: [self haltOnce]].!

Item was added:
+ ----- Method: ObjectTest>>testHaltOnceIf (in category 'tests - debugging') -----
+ testHaltOnceIf
+
+ self resetHaltOnceAfter: [
+ | requested |
+ self setHaltOnce.
+ self shouldHalt: [self haltOnceIf: true].
+ self shouldntHalt: [self haltOnceIf: true].
+
+ self setHaltOnce.
+ self shouldntHalt: [self haltOnceIf: false].
+ self assert: [self haltOnceEnabled].
+
+ self setHaltOnce.
+ requested := false.
+ self shouldHalt: [self haltOnceIf: [requested := true]].
+ self assert: requested.
+ requested := false.
+ self shouldntHalt: [self haltOnceIf: [requested := true]].
+ self deny: requested.
+
+ self setHaltOnce.
+ requested := false.
+ self shouldntHalt: [self haltOnceIf: [(requested := true) not]].
+ self assert: [self haltOnceEnabled].
+ self assert: requested.
+ requested := false.
+ self shouldntHalt: [self haltOnceIf: [(requested := true) not]].
+ self assert: [self haltOnceEnabled].
+ self assert: requested].!

Item was changed:
+ ----- Method: ObjectTest>>testNotNil (in category 'tests - debugging') -----
- ----- Method: ObjectTest>>testNotNil (in category 'tests - testing') -----
  testNotNil
 
  self assert: Object new notNil!