Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hooks (#canSimulateYourself & #failPrimitiveWith:) #49

Merged
merged 3 commits into from
Feb 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*SimulationStudio-Base-testing
canSimulateYourself
"Answer whether it is a valid operation to send #step to a thisContext instance of the receiver class."

^ true
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"fromSimulationContext:" : "ct 3/5/2021 19:41",
"runSimulated:" : "ct 11/14/2021 02:06" },
"instance" : {
"canSimulateYourself" : "ct 2/12/2022 15:12",
"debug" : "ct 12/30/2021 14:28",
"insertEnsure:" : "ct 3/5/2021 19:35",
"insertOn:do:" : "ct 3/5/2021 19:35",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ runSimulated: aBlock contextAtEachStep: anotherBlock

current := self customize: current.

(anotherBlock numArgs = 0
((home canSimulateYourself and: [anotherBlock numArgs = 0])
ifTrue: ["optimized" [resume]]
ifFalse: ["stop execution on time, don't expose simulation details to caller"
[(current sender == ensure and: [current willReturn]) or:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"printOn:" : "ct 12/28/2020 15:49",
"push:" : "ct 12/28/2020 19:07",
"runSimulated:" : "ct 1/10/2021 20:14",
"runSimulated:contextAtEachStep:" : "ct 1/23/2022 01:22",
"runSimulated:contextAtEachStep:" : "ct 2/12/2022 15:48",
"runUntilErrorOrReturnFrom:" : "ct 3/28/2021 12:10",
"send:to:with:lookupIn:" : "ct 12/29/2021 14:52",
"shouldNotImplement:" : "ct 12/28/2020 15:29",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
testing
canContextSimulateItself: aContext do: aBlock
<capability: #canSimulateYourself>

^ nextSimulator
ifNotNil: [nextSimulator canContextSimulateItself: aContext do: aBlock]
ifNil: [aBlock value]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
controlling
context: aContext failPrimitiveWith: maybePrimFailToken do: aBlock
<capability: #failPrimitiveWith:>

^ nextSimulator
ifNotNil: [nextSimulator context: aContext failPrimitiveWith: maybePrimFailToken do: aBlock]
ifNil: [aBlock value: maybePrimFailToken]
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"allSimulators" : "ct 11/18/2021 22:45",
"basicSimulate:do:" : "ct 11/13/2021 17:07",
"basicSimulate:do:chain:" : "ct 11/13/2021 17:07",
"canContextSimulateItself:do:" : "ct 2/12/2022 15:17",
"context:activateMethod:withArgs:receiver:do:" : "ct 11/13/2021 15:45",
"context:blockReturnConstant:do:" : "ct 11/13/2021 15:19",
"context:callPrimitive:do:" : "ct 11/13/2021 15:40",
Expand All @@ -29,6 +30,7 @@
"context:doPushActiveContext:" : "ct 11/12/2021 18:48",
"context:doPushReceiver:" : "ct 11/12/2021 18:49",
"context:doSingleRelease:" : "ct 1/12/2022 01:43",
"context:failPrimitiveWith:do:" : "ct 2/4/2022 20:59",
"context:jump:do:" : "ct 11/13/2021 15:41",
"context:jump:if:do:" : "ct 11/13/2021 15:41",
"context:lookupSelector:inClass:do:" : "ct 12/29/2021 01:54",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
canSimulateYourself

^ simulator canContextSimulateItself: self do: [super canSimulateYourself]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
system simulation
failPrimitiveWith: maybePrimFailToken

^ simulator context: self failPrimitiveWith: maybePrimFailToken do: [:theMaybePrimFailToken | super failPrimitiveWith: theMaybePrimFailToken]
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
"blockReturnConstant:" : "ct 11/13/2021 15:13",
"blockReturnTop" : "ct 11/12/2021 17:49",
"callPrimitive:" : "ct 11/13/2021 15:13",
"canSimulateYourself" : "ct 2/12/2022 15:29",
"directedSuperSend:numArgs:" : "ct 11/13/2021 15:13",
"doDup" : "ct 11/12/2021 17:49",
"doPop" : "ct 11/12/2021 17:50",
"doPrimitive:method:receiver:args:" : "ct 11/13/2021 15:08",
"failPrimitiveWith:" : "ct 2/4/2022 20:58",
"initializeFrom:" : "ct 11/12/2021 23:27",
"jump:" : "ct 11/13/2021 15:13",
"jump:if:" : "ct 11/13/2021 15:13",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ basicPerformTest

self
basicPerformTest: testCase
on: (Error, Halt), TestResult failure, UnhandledError
on: TestResult failure, TestResult allErrors, UnhandledError "just to be sure"
do: [:ex | exception := ex].

self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"testSelectorsFromGroups:" : "ct 1/7/2022 18:56",
"wantsToTest:" : "ct 3/5/2021 16:50" },
"instance" : {
"basicPerformTest" : "ct 12/27/2021 00:16",
"basicPerformTest" : "ct 2/12/2022 15:45",
"basicPerformTest:on:do:" : "ct 11/12/2021 19:37",
"contextClass" : "ct 3/14/2021 16:10",
"defaultTimeout" : "ct 12/27/2021 00:33",
Expand Down