File tree Expand file tree Collapse file tree 6 files changed +42
-7
lines changed
Babylonian-Core.package/BPMethodExample.class
BPAnnotationMorphsTest.class Expand file tree Collapse file tree 6 files changed +42
-7
lines changed Original file line number Diff line number Diff line change @@ -6,5 +6,11 @@ asPragma
66 self exampleName.
77 self setUpScript ifNil: [' ' ] ifNotNil: [:setUpScript | ' setUp: ' , setUpScript printString].
88 self tearDownScript ifNil: [' ' ] ifNotNil: [:tearDownScript | ' tearDown: ' , tearDownScript printString].
9- self receiverConstructor ifNil: [' ' ] ifNotNil: [:aReceiverConstructor | ' self: ' , aReceiverConstructor printString].
10- self argumentScripts ifEmpty: [' ' ] ifNotEmpty: [(self argumentScripts collect: [:anArgumentScript | ' with: ' , anArgumentScript printString]) join]}
9+ self receiverConstructor ifNil: [' ' ] ifNotNil: [:aReceiverConstructor |
10+ aReceiverConstructor isLiveSpecimenReference
11+ ifFalse: [' self: ' , aReceiverConstructor printString]
12+ ifTrue: [' self: ' , {#specimen . aReceiverConstructor printString} printString]].
13+ self argumentScripts ifEmpty: [' ' ] ifNotEmpty: [(self argumentScripts collect: [:anArgumentScript |
14+ ' with: ' , (anArgumentScript isLiveSpecimenReference
15+ ifFalse: [anArgumentScript printString]
16+ ifTrue: [{#specimen . anArgumentScript printString} printString])]) join]}
Original file line number Diff line number Diff line change 66 "argumentScriptStringAt:" : " pre 1/10/2023 16:17" ,
77 "argumentScripts" : " pre 7/23/2019 12:20" ,
88 "argumentScripts:" : " pre 7/23/2019 09:23" ,
9- "asPragma" : " pre 5/3/2021 17:03 " ,
9+ "asPragma" : " pre 1/10/2023 16:40 " ,
1010 "canBeUsedForDoIts" : " jb 12/3/2020 22:38" ,
1111 "initialize" : " pre 9/30/2020 09:55" ,
1212 "initializeFromMethod:" : " pre 6/7/2021 15:11" ,
Original file line number Diff line number Diff line change 1+ tests
2+ testRenderingExampleWithLiveSpecimen
3+ | example renderedSource anchorAttribute examplesAnnotation examplesMorph specimenReference |
4+ source := ' method
5+ ^ 2 + 3' asText.
6+ specimenReference := BPSpecimenReference new
7+ specimen;
8+ yourself .
9+ example := BPMethodExample new
10+ method: methodReference compiledMethod;
11+ exampleName: ' example 1' ;
12+ receiverConstructor: specimenReference;
13+ argumentScripts: #('Object new' #(1 2 3) nil );
14+ setUpScript: #basicSetUp ;
15+ tearDownScript: ' "do nothing"' ;
16+ yourself .
17+ BPExamples value add: example.
18+ examplesAnnotation := BPExamplesAnnotation new
19+ methodReference: methodReference;
20+ yourself .
21+ examplesMorph := examplesAnnotation asMorph.
22+ anchorAttribute := BPTextDecoration new anchoredMorph: examplesMorph.
23+ source addAttribute: anchorAttribute from: 1 to: 1 .
24+
25+ renderedSource := source asBPSource.
26+ self assert: ' method
27+ <exampleNamed: ' ' example 1' ' setUp: #basicSetUp tearDown: ' ' "do nothing"' ' self: #(#specimen ' ' nil' ' ) with: ' ' Object new' ' with: #(1 2 3) with: nil>
28+ ^ 2 + 3' equals: renderedSource
29+
Original file line number Diff line number Diff line change 1111 "setUp" : " pre 7/25/2019 12:06" ,
1212 "testRenderingExample" : " pre 7/20/2022 15:26" ,
1313 "testRenderingExampleSpecificReplacement" : " pre 7/20/2022 09:30" ,
14+ "testRenderingExampleWithLiveSpecimen" : " pre 1/10/2023 16:41" ,
1415 "testRenderingNestedProbes" : " pre 7/20/2022 09:30" ,
1516 "testRenderingNestedProbesWithDifferentLengths" : " pre 7/20/2022 09:30" ,
1617 "testRenderingProfilingProbe" : " pre 11/30/2022 09:51" ,
Original file line number Diff line number Diff line change 11tests
2- testLiveSpecimanExample
2+ testLiveSpecimenExample
33
4- | example specimen testRegistry reference |
5- testRegistry := BPSpecimenRegistry new .
4+ | example specimen reference |
65 specimen := Object new .
76 reference := BPSpecimenReference new
87 specimen: specimen;
Original file line number Diff line number Diff line change 2222 "testExamplesKnowTheirTimeout" : " joabe 9/29/2022 22:59" ,
2323 "testGetExamplesForAMethod" : " jb 12/7/2020 19:08" ,
2424 "testGetScriptExamplesForAMethod" : " pre 7/22/2022 21:39" ,
25- "testLiveSpecimanExample " : " pre 1/10/2023 16:24 " ,
25+ "testLiveSpecimenExample " : " pre 1/10/2023 16:30 " ,
2626 "testMethodExamplesCanAccessArgumentsInTheSetup" : " pre 8/6/2021 18:21" ,
2727 "testMethodExamplesCanAccessArgumentsInTheTeardown" : " pre 8/6/2021 18:21" ,
2828 "testMethodExamplesCanChangeArgumentsInTheSetup" : " pre 8/6/2021 18:20" ,
You can’t perform that action at this time.
0 commit comments