/
ClyActiveBreakpointsQueryTest.class.st
125 lines (97 loc) · 3.98 KB
/
ClyActiveBreakpointsQueryTest.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
Class {
#name : #ClyActiveBreakpointsQueryTest,
#superclass : #ClyMethodQueryTestCase,
#instVars : [
'installedBreakpoints'
],
#category : #'Calypso-SystemPlugins-Reflectivity-Queries-Tests-Breakpoints'
}
{ #category : #running }
ClyActiveBreakpointsQueryTest >> createQuery [
^ClyActiveBreakpointsQuery from: ClyClassScope of: ClyClassWithHalts in: environment
]
{ #category : #running }
ClyActiveBreakpointsQueryTest >> installBreakpointInto: aMethod [
| breakpoint |
breakpoint := Breakpoint new node: aMethod ast; always.
installedBreakpoints add: breakpoint.
breakpoint install
]
{ #category : #running }
ClyActiveBreakpointsQueryTest >> setUp [
super setUp.
installedBreakpoints := OrderedCollection new
]
{ #category : #running }
ClyActiveBreakpointsQueryTest >> tearDown [
installedBreakpoints do: [ :each | each remove ].
installedBreakpoints removeAll.
super tearDown
]
{ #category : #tests }
ClyActiveBreakpointsQueryTest >> testCheckIfEmpty [
self installBreakpointInto: (ClyClassWithBreakpoints >> #methodWithBreakpoints).
query scope: (ClyMethodScope
of: (ClyClassWithHalts >> #methodWithHalts1) in: environment).
self deny: query checkEmptyResult.
query scope: (ClyMethodScope
of: (ClyClassWithBreakpoints >> #methodWithBreakpoints) in: environment).
self deny: query checkEmptyResult.
query scope: (ClyMethodScope
of: (ClyClassWithBreakpoints >> #methodWithoutBreakpoints) in: environment).
self assert: query checkEmptyResult
]
{ #category : #tests }
ClyActiveBreakpointsQueryTest >> testComparison [
self
assert: (ClyActiveBreakpointsQuery new)
equals: (ClyActiveBreakpointsQuery new).
self
assert: (ClyActiveBreakpointsQuery newIncludingHaltsForTesting)
equals: (ClyActiveBreakpointsQuery newIncludingHaltsForTesting).
self deny: (ClyActiveBreakpointsQuery new) = (ClyActiveBreakpointsQuery newIncludingHaltsForTesting).
]
{ #category : #tests }
ClyActiveBreakpointsQueryTest >> testDecoratingMethodWithBreakpoint [
| plugin method methodItem |
plugin := ClyReflectiveEnvironmentPlugin new.
self installBreakpointInto: (ClyClassWithBreakpoints >> #methodWithBreakpoints).
method := ClyClassWithBreakpoints >> #methodWithBreakpoints.
methodItem := method asCalypsoBrowserItem.
plugin decorateBrowserItem: methodItem ofMethod: method.
self assert: (methodItem isMarkedWith: ClyMethodWithBreakpointTag).
self deny: (methodItem isMarkedWith: ClyMethodWithHaltTag).
]
{ #category : #tests }
ClyActiveBreakpointsQueryTest >> testDecoratingMethodWithHalt [
| plugin method methodItem |
plugin := ClyReflectiveEnvironmentPlugin new.
method := ClyClassWithHalts >> #methodWithHalts1.
methodItem := method asCalypsoBrowserItem.
plugin decorateBrowserItem: methodItem ofMethod: method.
self assert: (methodItem isMarkedWith: ClyMethodWithHaltTag).
self deny: (methodItem isMarkedWith: ClyMethodWithBreakpointTag)
]
{ #category : #tests }
ClyActiveBreakpointsQueryTest >> testFromThreeMethods [
self installBreakpointInto: (ClyClassWithBreakpoints >> #methodWithBreakpoints).
self queryFromScope: ClyMethodScope ofAll: {
ClyClassWithHalts >> #methodWithHalts1.
ClyClassWithBreakpoints >> #methodWithBreakpoints.
ClyClassWithBreakpoints >> #methodWithoutBreakpoints}.
self assert: foundSelectors sorted asArray equals: #(#methodWithBreakpoints #methodWithHalts1)
]
{ #category : #tests }
ClyActiveBreakpointsQueryTest >> testNotSelectsMethodWithoutBreakpoint [
self installBreakpointInto: (ClyClassWithBreakpoints >> #methodWithBreakpoints).
self deny: (query selectsMethod: ClyClassWithBreakpoints >> #methodWithoutBreakpoints)
]
{ #category : #tests }
ClyActiveBreakpointsQueryTest >> testSelectsMethodWithBreakpoint [
self installBreakpointInto: (ClyClassWithBreakpoints >> #methodWithBreakpoints).
self assert: (query selectsMethod: ClyClassWithBreakpoints >> #methodWithBreakpoints)
]
{ #category : #tests }
ClyActiveBreakpointsQueryTest >> testSelectsMethodWithHalt [
self assert: (query selectsMethod: ClyClassWithHalts>>#methodWithHalts1)
]