Skip to content

Commit

Permalink
Merge branch 'develop' into error/fix-morph-resizing
Browse files Browse the repository at this point in the history
  • Loading branch information
ekrebs5 committed Oct 2, 2023
1 parent 2298b89 commit 49546a7
Show file tree
Hide file tree
Showing 76 changed files with 178 additions and 188 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"classinstvars" : [
],
"classvars" : [
],
"IgnoredClassesInStack",
"IgnoredMessagesInStack" ],
"commentStamp" : "",
"instvars" : [
"tracedValue",
Expand Down
2 changes: 1 addition & 1 deletion packages/Babylonian-ExampleMining.package/.squot-contents
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ SquotTrackedObjectMetadata {
#id : UUID [ '31a714b5b534fd4988afa4e5447e0082' ],
#objectsReplacedByNames : true,
#serializer : #SquotCypressCodeSerializer
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ addArgumentScriptMorphs
| editField container |
self example argumentNames withIndexDo: [:argumentName :index |
container := self newLabelContainerMorph: (argumentName , ': ').
container cellInset: self defaultCellInset;
layoutInset: self defaultLayoutInset.

editField := self
editFieldStyledInitialContent: (self example argumentScriptStringAt: index)
Expand All @@ -15,7 +13,9 @@ addArgumentScriptMorphs
onAccept: [:str |
self acceptChangesAtSource.
false "Do not continue handling this morphs edit"].
editField balloonText: 'write code that instantiates the argument'.
editField
balloonText: 'write code that instantiates the argument';
width: 240.
container addMorphBack: editField.

"Live specimen editing"
Expand All @@ -28,6 +28,5 @@ addArgumentScriptMorphs
self example argumentScripts at: index put: specimen.
self codeContentChanged.
editField setText: (self example argumentScriptStringAt: index)]]).


exampleSpecificMorphs addMorphBack: container].
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ addReceiverConstructorMorph

| container editField |
container := self newLabelContainerMorph: 'self: '.
container cellInset: self defaultCellInset;
layoutInset: self defaultLayoutInset.

editField := (self
editFieldStyledInitialContent: self example receiverConstructorString
Expand All @@ -16,7 +14,8 @@ addReceiverConstructorMorph
editField
balloonText: 'Write code that instantiates the receiver.
You can also provide a selector that will be called on the
class-side of this class to create a receiver object.'.
class-side of this class to create a receiver object.';
width: 240.
container addMorphBack: editField.

"Live specimen editing"
Expand All @@ -29,5 +28,5 @@ class-side of this class to create a receiver object.'.
self example receiverConstructor: specimen.
self codeContentChanged.
editField setText: self example receiverConstructorString]]).

exampleSpecificMorphs addMorphBack: container.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"class" : {
},
"instance" : {
"addArgumentScriptMorphs" : "joabe 8/9/2023 16:45",
"addReceiverConstructorMorph" : "joabe 8/9/2023 16:45",
"addArgumentScriptMorphs" : "joabe 7/6/2023 22:59",
"addReceiverConstructorMorph" : "joabe 7/6/2023 22:51",
"newSpecimenEditingButtonFor:" : "ek 7/24/2023 18:34" } }
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ executing
runOn: unused

self testCaseClass ifNotNil: [
self testResult: (self testCaseClass run: self methodSelector)]
self testCaseClass run: self methodSelector]

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
"methodSelector" : "joabe 7/10/2023 16:01",
"methodSelector:" : "joabe 7/10/2023 16:01",
"morphClass" : "joabe 7/10/2023 16:00",
"runOn:" : "joabe 7/10/2023 16:02",
"runOn:" : "pre 8/22/2023 12:04",
"testCaseClass" : "joabe 7/10/2023 16:02",
"testCaseClass:" : "joabe 7/10/2023 16:01",
"testCaseClassFrom:" : "joabe 7/10/2023 16:04",
"testResult" : "joabe 7/10/2023 16:03",
"testResult:" : "joabe 7/10/2023 16:03" } }
"testCaseClassFrom:" : "joabe 7/10/2023 16:04" } }
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"commentStamp" : "",
"instvars" : [
"testCaseClass",
"methodSelector",
"testResult" ],
"methodSelector" ],
"name" : "BPTestCaseExample",
"pools" : [
],
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SystemOrganization addCategory: #'Babylonian-ExampleMining-Core'!
SystemOrganization addCategory: #'Babylonian-ExampleMining-Minimization'!
SystemOrganization addCategory: #'Babylonian-ExampleMining-Tests'!
SystemOrganization addCategory: #'Babylonian-ExampleMining-Core'!
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ update: anAspect with: anObject
super update: anAspect with: anObject.

anAspect = #newTrace ifTrue: [
anObject first ifNotNil: [
Project current addDeferredUIMessage: [
anObject first ifNotNil: [
anObject first addDependent: self.
self removeAllMorphs.
self visualize]]].

(anAspect = #exampleCompleted or: [anAspect = #traceChanged]) ifTrue: [
Project current addDeferredUIMessage: [
self removeAllMorphs.
self visualize]].

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"newTitleMorphFor:" : "jb 2/22/2022 21:29",
"stacksFor:" : "pre 11/16/2022 16:05",
"titleMorphCloses" : "jb 1/27/2022 17:58",
"update:with:" : "lu 3/7/2022 01:54",
"update:with:" : "pre 8/15/2023 15:52",
"updateLayoutToContext" : "jb 11/20/2021 01:33",
"visualize" : "lu 3/6/2022 22:45",
"visualizeLinesFor:" : "pre 11/16/2022 16:22" } }
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ setUp

methodReference := MethodReference class: BPAnnotationMorphsTest selector: #method.
source := ('method
<exampleNamed: ''example 1''>
^ ' , Character startOfHeader , '2 + 3') asText.
<exampleNamed: ''example 1''>
^ 2 + 3') asText.
expressionInterval := 39 to: 43.

Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ testRenderingSimpleSlider
id: 10;
asMorph.
anchorAttribute := BPTextDecoration new anchoredMorph: slideMorph.
expressionInterval := 57 to: 69.
expressionInterval := 57 to: 68.
source := ('methodWithBlock
<exampleNamed: ''example 1''>
^ self do: ',Character startOfHeader,'[:r | 2 + 3]') asText.
^ self do: [:r | 2 + 3]') asText.
source addAttribute: anchorAttribute from: expressionInterval start to: expressionInterval stop.

renderedSource := source asBPSource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ testRenderingSliderWithNestedProbe
methodReference := MethodReference class: BPAnnotationMorphsTest selector: #methodWithBlock.
source := ('methodWithBlock
<exampleNamed: ''example 1''>
^ self do: ',Character startOfHeader,'[:r | ',Character startOfHeader,'2 + 3]') asText.
^ self do: [:r | 2 + 3]') asText.

sliderMorph := BPSlider new
methodReference: methodReference;
id: 10;
asMorph.
anchorAttribute := BPTextDecoration new anchoredMorph: sliderMorph.
source addAttribute: anchorAttribute from: 57 to: 70.
source addAttribute: anchorAttribute from: 57 to: 68.

probeMorph := BPProbe new
id: 1;
methodReference: methodReference;
asMorph.
anchorAttribute := BPTextDecoration new anchoredMorph: probeMorph.
source addAttribute: anchorAttribute from: 65 to: 69.
source addAttribute: anchorAttribute from: 63 to: 67.

renderedSource := source asBPSource.
self assert: 'methodWithBlock
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ testRenderingWithoutExamples

| example renderedSource anchorAttribute examplesAnnotation examplesMorph |
source := ('method
',Character startOfHeader,'
^ 2 + 3') asText.
example := BPMethodExample new
method: methodReference compiledMethod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"methodWithBlock" : "jb 12/3/2020 22:59",
"methodWithBlockAndProbe" : "jb 12/7/2020 19:05",
"runCase" : "pre 5/6/2021 17:00",
"setUp" : "pre 7/25/2019 12:06",
"setUp" : "pre 8/17/2023 08:30",
"testRenderingExample" : "pre 7/20/2022 15:26",
"testRenderingExampleSpecificReplacement" : "pre 7/20/2022 09:30",
"testRenderingExampleWithLiveSpecimen" : "pre 1/10/2023 16:41",
Expand All @@ -23,9 +23,9 @@
"testRenderingSimpleLabelProbe" : "lu 7/9/2021 22:21",
"testRenderingSimpleProbe" : "pre 7/20/2022 09:26",
"testRenderingSimpleReplacement" : "pre 7/20/2022 09:26",
"testRenderingSimpleSlider" : "pre 7/20/2022 09:26",
"testRenderingSimpleSlider" : "pre 8/17/2023 08:33",
"testRenderingSimpleTemporaryProbe" : "pre 11/30/2022 09:52",
"testRenderingSimpleTypeProbe" : "pre 11/30/2022 09:50",
"testRenderingSliderWithNestedProbe" : "pre 7/20/2022 09:26",
"testRenderingWithoutExamples" : "pre 7/20/2022 09:30",
"testRenderingSliderWithNestedProbe" : "pre 8/17/2023 09:32",
"testRenderingWithoutExamples" : "pre 8/17/2023 08:35",
"testRenderingWorldExample" : "pre 9/6/2022 11:18" } }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
failures
expectedFailures

^ #()
^ #(testMethodExamplesCanAccessArgumentsInTheTeardown testMethodExamplesCanAccessArgumentsInTheSetup testMethodExamplesCanChangeArgumentsInTheSetup) "Nowadays it is the other way around. Information from the setup is available in the receiver and argument scripts"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tests
testExamplesKnowTheirTimeout

self assert: ((method bpExamples collect: [:example | example timeout]) includes: 30000).
self assert: ((method bpExamples collect: [:example | example timeout]) includes: 5000).
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
},
"instance" : {
"createExamples" : "pre 1/11/2023 14:05",
"expectedFailures" : "pre 2/22/2021 17:24",
"expectedFailures" : "pre 8/22/2023 11:39",
"runCase" : "pre 5/4/2021 15:23",
"setUp" : "pre 1/11/2023 14:04",
"tearDown" : "pre 5/20/2021 15:33",
Expand All @@ -19,7 +19,7 @@
"testExamplesKnowTheirOriginalMethod" : "jb 12/7/2020 19:08",
"testExamplesKnowTheirSetUp" : "pre 1/21/2021 16:49",
"testExamplesKnowTheirTearDown" : "pre 1/21/2021 16:46",
"testExamplesKnowTheirTimeout" : "joabe 9/29/2022 22:59",
"testExamplesKnowTheirTimeout" : "pre 8/23/2023 13:32",
"testGetExamplesForAMethod" : "jb 12/7/2020 19:08",
"testGetScriptExamplesForAMethod" : "pre 7/22/2022 21:39",
"testLiveSpecimenExample" : "pre 1/10/2023 16:30",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ testStylerReusesExamplesMorphWhenStyledAgain
originalSourceCode := 'method' asText.

formattedSourceCode := styler format: originalSourceCode.
oldAttributes := formattedSourceCode attributesAt: (formattedSourceCode asString indexOf: Character startOfHeader).
oldAttributes := formattedSourceCode attributesAt: 1.
oldAttributes := oldAttributes select: [:anAttribute | styler hasExamplesMorph: anAttribute].

formattedSourceCode := styler format: formattedSourceCode.
newAttributes := formattedSourceCode attributesAt: (formattedSourceCode asString indexOf: Character startOfHeader).
newAttributes := formattedSourceCode attributesAt: 1.
newAttributes := newAttributes select: [:anAttribute | styler hasExamplesMorph: anAttribute].

self assert: oldAttributes first identical: newAttributes first.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"testStylerAddsExamplesMorphForEmptyTwoNewLinedMethodBody" : "jb 8/29/2021 20:32",
"testStylerAddsExamplesMorphForSomeFilledMethodBody" : "jb 8/29/2021 20:44",
"testStylerCanCopeWithProbeWithinSliderRange" : "pre 9/2/2022 16:10",
"testStylerReusesExamplesMorphWhenStyledAgain" : "jb 8/29/2021 20:43",
"testStylerReusesExamplesMorphWhenStyledAgain" : "pre 8/17/2023 08:38",
"testStylerSetsAnchorAttributeForAttributeProbe" : "pre 7/23/2022 16:14",
"testStylerSetsAnchorAttributeForNestedProbes" : "jb 10/24/2021 22:16",
"testStylerSetsAnchorAttributeForProbe" : "jb 10/24/2021 22:16",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
example methods
binarySearchIn: aCollection theElement: anElement
<exampleNamed: 'basic' self: #empty with: '#(3 1 2)' with: '1'>
<exampleNamed: 'small example' self: #empty with: '#(3 1 2)' with: '1'>
<exampleNamed: 'error example' self: #empty with: #(1 2 4) with: '3'>
<exampleNamed: 'complex example' setUp: '#basicSetUpScript' tearDown: '#basicTearDownScript' self: #empty with: '{Date yesterday . DateAndTime tomorrow . Date today}' with: 'Date today'>
<exampleNamed: 'basic' self: '#empty' with: '#(3 1 2)' with: '1'>
<exampleNamed: 'small example' self: '#empty' with: '#(3 1 2)' with: '1'>
<exampleNamed: 'error example' self: '#empty' with: '#(1 2 4)' with: '3'>
<exampleNamed: 'complex example' setUp: '#basicSetUpScript' tearDown: '#basicTearDownScript' self: '#empty' with: '{Date yesterday . DateAndTime tomorrow . Date today}' with: 'Date today'>
| index low test distance high |
low := 1.
high := aCollection size.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"instance" : {
"+" : "pre 7/1/2019 14:23",
"addAndLog:" : "pre 5/3/2021 10:36",
"binarySearchIn:theElement:" : "pre 1/21/2021 16:48",
"binarySearchIn:theElement:" : "ek 9/29/2023 09:13",
"methodOnlyWithExample" : "pre 11/18/2019 12:07",
"methodWithExampleCallingOnlyProbedMethod" : "jb 7/2/2021 00:56",
"methodWithLiveSpecimen:" : "pre 9/30/2020 09:41",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ editFieldFor: model text: getTextSelector onChange: setTextSelector onAccept: ac
wrapFlag: true;
wantsFrameAdornments: false;
cellPositioning: #topLeft;
layoutInset: 0.
layoutInset: 0;
width: ((TextStyle defaultFont widthOfString: (model perform: getTextSelector)) + (self fontWidth)
max: (20 * self fontWidth)).
^ pluggableTextMorph
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ editFieldStyledInitialContent: aText onChange: changeBlock onAccept: acceptBlock
onAccept: acceptBlock.

field
hResizing: #spaceFill;
styler: (SHTextStylerST80 new view: field);
updateStyleNow.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
private
getTraces

^ BPExamples value paddedTracesOfActiveExamples
reject: [:aTrace | aTrace isNil]

^ BPExamples value paddedTracesOfActiveExamples
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ initialize
listDirection: #leftToRight;
vResizing: #shrinkWrap;
cellInset: 1;
layoutInset: 5@1.
layoutInset: 1.

BPStyler
withSidebarAnnotations: [
Expand Down

This file was deleted.

Loading

0 comments on commit 49546a7

Please sign in to comment.