Skip to content

Commit

Permalink
Adds executeSynchronously and changes semantic of execute to match th…
Browse files Browse the repository at this point in the history
…e general Babylonian model.
  • Loading branch information
codeZeilen committed Jul 13, 2023
1 parent 93c0d03 commit 3c3678a
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ executing
debug

(Process
forBlock: [self execute]
forBlock: [self executeSynchronously]
runUntil: [:context | context selector = #runOn:]) debug.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
executing
execute

<bpRelevantMethod>
| state |
state := self prepareRunState.
self runSetUpWith: state.
[ ^ self runWithTimeoutOn: state] ensure: [self runTearDownWith: state]
^ [self executeSynchronously]
forkAt: Processor userBackgroundPriority
named: 'Example process for: ' , self exampleName
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
executing
executeSynchronously

<bpRelevantMethod>
| state |
state := self prepareRunState.
self runSetUpWith: state.
[ ^ self runWithTimeoutOn: state] ensure: [self runTearDownWith: state]
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ tracing
trace

<bpRelevantMethod>
^ self traceInformation trace: ([self execute] bpTraceForExample: self)
^ self traceInformation trace: ([self executeSynchronously] bpTraceForExample: self)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ traceInBackground
| traceAndProcess |
self ensureTerminatedProcess.

traceAndProcess := [self execute] bpTraceInBackgroundForExample: self.
traceAndProcess := [self executeSynchronously] bpTraceInBackgroundForExample: self.
self traceInformation
trace: traceAndProcess first;
tracingProcess: traceAndProcess second.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ traceToHaltAt: anAnnotationId onCount: aCount
only to bring us to the probe as quickly as possible"

| exampleExecution |
exampleExecution := [[([self execute] bpTraceForExample: self andHaltAt: anAnnotationId onCount: aCount)]
exampleExecution := [[([self executeSynchronously] bpTraceForExample: self andHaltAt: anAnnotationId onCount: aCount)]
on: BPExampleExecutionInterrupted
do: [:anError | | methodContext process traceMethodReferences |
traceMethodReferences := {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
"canBeUsedForDoIts" : "pre 10/6/2020 09:17",
"color" : "pre 3/2/2021 17:32",
"currentTrace" : "pre 1/11/2023 10:41",
"debug" : "pre 7/20/2022 18:02",
"debug" : "pre 7/13/2023 10:44",
"ensureTerminatedProcess" : "pre 1/11/2023 16:21",
"exampleName" : "pre 1/11/2023 10:47",
"exampleName:" : "pre 1/11/2023 10:47",
"execute" : "joabe 9/29/2022 00:20",
"execute" : "pre 7/13/2023 10:44",
"executeSynchronously" : "pre 7/13/2023 10:44",
"expectedResult" : "pre 1/11/2023 10:47",
"expectedResult:" : "pre 1/11/2023 10:47",
"hasExpectedResult" : "joabe 9/28/2022 22:56",
Expand Down Expand Up @@ -48,11 +49,11 @@
"timeout" : "pre 1/11/2023 10:46",
"timeout:" : "pre 1/11/2023 10:46",
"toggleIsActive" : "pre 10/23/2020 10:16",
"trace" : "pre 1/11/2023 10:46",
"traceInBackground" : "pre 1/11/2023 10:46",
"trace" : "pre 7/13/2023 10:44",
"traceInBackground" : "pre 7/13/2023 10:44",
"traceInformation" : "pre 1/11/2023 10:46",
"traceToHaltAt:" : "lu 11/27/2021 14:06",
"traceToHaltAt:onCount:" : "lu 11/27/2021 14:03",
"traceToHaltAt:onCount:" : "pre 7/13/2023 10:44",
"traceValues" : "lu 12/6/2021 14:49",
"traceValuesMorphs" : "jb 5/20/2021 01:03",
"tracingIsStillRunning" : "pre 1/12/2023 09:40",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
executing
executeSynchronously

^ referencedExample executeSynchronously
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"exampleName" : "pre 1/11/2023 14:51",
"exampleName:" : "pre 1/11/2023 10:58",
"execute" : "pre 1/11/2023 14:07",
"executeSynchronously" : "pre 7/13/2023 10:45",
"expectedResult" : "pre 1/11/2023 14:29",
"expectedResult:" : "pre 1/11/2023 13:20",
"initialize" : "pre 1/11/2023 10:36",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ignoredMessagesInStack
MethodReference class: DynamicVariable class selector: #value:during:.
MethodReference class: BPExample selector: #traceAsyncNotifying:.
MethodReference class: BPExample selector: #execute.
MethodReference class: BPExample selector: #executeSynchronously.
MethodReference class: BPMethodExample selector: #runOn:.
MethodReference class: CSMethodObject selector: #run:with:in:.
MethodReference class: CSLayeredMethod selector: #valueWithReceiver:arguments:.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"containedMethodReference" : "pre 11/16/2022 16:04",
"filteredStack" : "pre 11/16/2022 15:57",
"ignoredClassesInStack" : "joabe 7/2/2023 23:53",
"ignoredMessagesInStack" : "pre 1/11/2023 10:15",
"ignoredMessagesInStack" : "pre 7/13/2023 10:45",
"isStackFull" : "jb 6/30/2021 01:26",
"printOn:" : "jb 5/19/2021 20:59",
"shouldBeIgnored:" : "pre 11/16/2022 16:04",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ testExampleWithTooManyArguments

| example |
example := (BPTestExamplesClass>>#methodWithTooLargeExample:) bpExamples first. "there is only one"
self assert: 30 equals: example execute.
self assert: 30 equals: example executeSynchronously.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ testMethodExamplesCanChangeArgumentsInTheSetup
| example |
example := self createExamples first.
example setUpScript: 'anElement := 1.'.
self assert: 1 equals: example execute.
self assert: 1 equals: example executeSynchronously.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ testReferencingExampleRunsTheOtherExample
| example referencingExample |
example := self createExamples first.
referencingExample := self createExamples third.
self assert: 2 equals: referencingExample execute.
self assert: 2 equals: referencingExample executeSynchronously.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ testScriptExamplesCanAccessArgumentsFromTheSetup
| example |
example := (BPTestExamplesClass>>#methodWithScriptExamples) bpExamples detect: [:someExample |
someExample exampleName = 'yetAnother'].
self assert: #(1 2 3) equals: example execute.
self assert: #(1 2 3) equals: example executeSynchronously.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ testScriptExamplesCanAccessArgumentsInTheTeardown
setUpScript: 'setupVariable := #(1 2 3).';
tearDownScript: 'Notification signal: setupVariable asString'.
result := nil.
[example execute]
[example executeSynchronously]
on: Notification
do: [:n | result := n messageText].
self assert: '#(1 2 3)' equals: result.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"setUp" : "pre 1/11/2023 14:04",
"tearDown" : "pre 5/20/2021 15:33",
"testCreatingAnExampleNotifiesDependents" : "pre 5/20/2021 15:40",
"testExampleWithTooManyArguments" : "pre 8/6/2021 18:25",
"testExampleWithTooManyArguments" : "pre 7/13/2023 10:44",
"testExamplesCanBeRemovedFromTheirMethod" : "pre 5/4/2021 15:30",
"testExamplesCanRunTheirSetup" : "pre 1/19/2023 10:21",
"testExamplesCanRunTheirSymbolSetup" : "pre 1/19/2023 10:21",
Expand All @@ -26,15 +26,15 @@
"testMethodExamplesCanAccessArgumentsInTheSetup" : "pre 1/19/2023 10:21",
"testMethodExamplesCanAccessArgumentsInTheTeardown" : "pre 1/19/2023 10:21",
"testMethodExamplesCanAccessTheEnclosingClassAsSelf" : "pre 1/11/2023 15:17",
"testMethodExamplesCanChangeArgumentsInTheSetup" : "pre 8/6/2021 18:20",
"testMethodExamplesCanChangeArgumentsInTheSetup" : "pre 7/13/2023 10:44",
"testNewExample" : "pre 6/7/2021 15:12",
"testNewExampleArePartOfTheirMethod" : "pre 1/6/2021 19:06",
"testNewExampleOnMetaclass" : "pre 7/22/2022 21:44",
"testReferencingExampleHasItsOwnActiveState" : "pre 1/11/2023 14:08",
"testReferencingExampleHasItsOwnTracingState" : "pre 1/11/2023 14:08",
"testReferencingExampleRunsTheOtherExample" : "pre 1/11/2023 13:59",
"testReferencingExampleRunsTheOtherExample" : "pre 7/13/2023 10:44",
"testReferencingExampleShowTheNamesOfTheReferencedOne" : "pre 1/11/2023 15:10",
"testRemovingAnExampleNotifiesDependents" : "pre 5/20/2021 15:30",
"testScriptExamplesCanAccessArgumentsFromTheSetup" : "pre 7/22/2022 21:38",
"testScriptExamplesCanAccessArgumentsInTheTeardown" : "pre 7/22/2022 21:40",
"testScriptExamplesCanAccessArgumentsFromTheSetup" : "pre 7/13/2023 10:44",
"testScriptExamplesCanAccessArgumentsInTheTeardown" : "pre 7/13/2023 10:44",
"update:" : "pre 1/6/2021 19:07" } }
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ testTracingExecutesMethodOnTheConstructedReceiver

| example result |
example := (BPTestManuallyInstrumentedClass>>#actualMethodWithAReceiver) bpExamples first.
result := example execute.
result := example executeSynchronously.
self assert: 22 equals: result.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"testTheTracingReturnsTheExpressionValueAnyways" : "jb 12/7/2020 19:10",
"testTracingAnErrorRecordsTheStack" : "jb 12/7/2020 19:10",
"testTracingAnErrorShouldNotLeakAnyExceptions" : "jb 12/7/2020 19:11",
"testTracingExecutesMethodOnTheConstructedReceiver" : "jb 12/7/2020 19:11",
"testTracingExecutesMethodOnTheConstructedReceiver" : "pre 7/13/2023 10:45",
"testTracingInBackgroundHandlesRunningProcess" : "pre 1/11/2023 13:48",
"testTracingOfAssignments" : "jb 12/7/2020 19:11",
"testTracingRecordsASerializedStack" : "pre 11/16/2022 16:35",
Expand Down

0 comments on commit 3c3678a

Please sign in to comment.