diff --git a/src/Reflectivity-Tools-Tests/BreakpointTest.class.st b/src/Reflectivity-Tools-Tests/BreakpointTest.class.st index 605bdba5ca2..33b887f6e21 100644 --- a/src/Reflectivity-Tools-Tests/BreakpointTest.class.st +++ b/src/Reflectivity-Tools-Tests/BreakpointTest.class.st @@ -214,8 +214,11 @@ BreakpointTest >> testObjectCentricAPI [ object2 := ReflectivityExamples new. Breakpoint breakOn: #exampleAssignment inObject: object1. - self should: [object1 exampleAssignment] raise: Break. + self shouldnt: [object2 exampleAssignment] raise: Break. + + Breakpoint breakOnceOn: #exampleAssignment inObject: object2. + self should: [object2 exampleAssignment] raise: Break. self shouldnt: [object2 exampleAssignment] raise: Break ] @@ -227,8 +230,11 @@ BreakpointTest >> testObjectCentricASTAPI [ ast := (ReflectivityExamples >> #exampleAssignment) ast statements first. Breakpoint breakOnAST: ast inObject: object1. - self should: [object1 exampleAssignment] raise: Break. + self shouldnt: [object2 exampleAssignment] raise: Break. + + Breakpoint breakOnceOnAST: ast inObject: object2. + self should: [object2 exampleAssignment] raise: Break. self shouldnt: [object2 exampleAssignment] raise: Break ] @@ -258,11 +264,27 @@ BreakpointTest >> testObjectCentricObjectAPI [ object2 := ReflectivityExamples new. object1 haltOnCallTo: #exampleAssignment. - self should: [object1 exampleAssignment] raise: Break. + self shouldnt: [object2 exampleAssignment] raise: Break. + + object2 haltOnceOnCallTo: #exampleAssignment. + self should: [object2 exampleAssignment] raise: Break. self shouldnt: [object2 exampleAssignment] raise: Break ] +{ #category : 'tests' } +BreakpointTest >> testOnceBreakpointDisableAfterHit [ + |object breakpoint| + object := ReflectivityExamples new. + + breakpoint := Breakpoint breakOnceOn: #exampleAssignment inObject: object. + breakpoint disable. + self shouldnt: [object exampleAssignment] raise: Break. + breakpoint enable. + self should: [object exampleAssignment] raise: Break. + self deny: breakpoint isEnabled +] + { #category : 'tests' } BreakpointTest >> testRemoveBreakpointWithRemoveFrom [ |bp node | diff --git a/src/Reflectivity-Tests/VariableBreakpointMockClass.class.st b/src/Reflectivity-Tools-Tests/VariableBreakpointMockClass.class.st similarity index 87% rename from src/Reflectivity-Tests/VariableBreakpointMockClass.class.st rename to src/Reflectivity-Tools-Tests/VariableBreakpointMockClass.class.st index 84457d4faa0..c3d6e4b3430 100644 --- a/src/Reflectivity-Tests/VariableBreakpointMockClass.class.st +++ b/src/Reflectivity-Tools-Tests/VariableBreakpointMockClass.class.st @@ -10,9 +10,8 @@ Class { #classVars : [ 'ClassVar' ], - #category : 'Reflectivity-Tests-Breakpoints', - #package : 'Reflectivity-Tests', - #tag : 'Breakpoints' + #category : 'Reflectivity-Tools-Tests', + #package : 'Reflectivity-Tools-Tests' } { #category : 'accessing' } diff --git a/src/Reflectivity-Tests/VariableBreakpointTest.class.st b/src/Reflectivity-Tools-Tests/VariableBreakpointTest.class.st similarity index 99% rename from src/Reflectivity-Tests/VariableBreakpointTest.class.st rename to src/Reflectivity-Tools-Tests/VariableBreakpointTest.class.st index d33564c3f91..ac0913b68f8 100644 --- a/src/Reflectivity-Tests/VariableBreakpointTest.class.st +++ b/src/Reflectivity-Tools-Tests/VariableBreakpointTest.class.st @@ -11,9 +11,8 @@ Class { 'testClass', 'testSubclass' ], - #category : 'Reflectivity-Tests-Breakpoints', - #package : 'Reflectivity-Tests', - #tag : 'Breakpoints' + #category : 'Reflectivity-Tools-Tests', + #package : 'Reflectivity-Tools-Tests' } { #category : 'helpers' } diff --git a/src/Reflectivity/Breakpoint.class.st b/src/Reflectivity/Breakpoint.class.st index 5485cbcc783..25c16011336 100644 --- a/src/Reflectivity/Breakpoint.class.st +++ b/src/Reflectivity/Breakpoint.class.st @@ -70,6 +70,26 @@ Breakpoint class >> breakOnAST: aNode inObject: anObject [ ^ breakpoint ] +{ #category : 'API - object-centric' } +Breakpoint class >> breakOnceOn: aSelector inObject: anObject [ + + | ast | + ast := (anObject class lookupSelector: aSelector) ast. + ^ self breakOnceOnAST: ast inObject: anObject +] + +{ #category : 'API - object-centric' } +Breakpoint class >> breakOnceOnAST: aNode inObject: anObject [ + + | breakpoint | + breakpoint := self new. + breakpoint once: true. + breakpoint node: aNode. + breakpoint scopeTo: anObject. + breakpoint install. + ^ breakpoint +] + { #category : 'accessing' } Breakpoint class >> browseAll [