@@ -95,210 +95,55 @@ object OverrideTests extends TestSuite {
9595 lazy val millDiscover = Discover [this .type ]
9696 }
9797 val tests = Tests {
98- object graphs extends TestGraphs ()
99- import graphs ._
10098 import TestGraphs ._
10199 import utest ._
102- test(" evaluateSingle" ) {
103100
104- test(" singleton " ) {
105- import singleton . _
106- val check = new Checker (singleton)
107- // First time the target is evaluated
108- check(single, expValue = 0 , expEvaled = Agg (single))
101+ test(" overrideSuperTask " ) {
102+ // Make sure you can override targets, call their supers, and have the
103+ // overridden target be allocated a spot within the overridden/ folder of
104+ // the main publicly-available target
105+ import canOverrideSuper . _
109106
110- single.counter += 1
111- // After incrementing the counter, it forces re-evaluation
112- check(single, expValue = 1 , expEvaled = Agg (single))
113- }
114- test(" backtickIdentifiers" ) {
115- import graphs .bactickIdentifiers ._
116- val check = new Checker (bactickIdentifiers)
117-
118- check(`a-down-target`, expValue = 0 , expEvaled = Agg (`up-target`, `a-down-target`))
119-
120- `a-down-target`.counter += 1
121- check(`a-down-target`, expValue = 1 , expEvaled = Agg (`a-down-target`))
122-
123- `up-target`.counter += 1
124- check(`a-down-target`, expValue = 2 , expEvaled = Agg (`up-target`, `a-down-target`))
125- }
126- test(" pair" ) {
127- import pair ._
128- val check = new Checker (pair)
129- check(down, expValue = 0 , expEvaled = Agg (up, down))
130-
131- down.counter += 1
132- check(down, expValue = 1 , expEvaled = Agg (down))
133-
134- up.counter += 1
135- check(down, expValue = 2 , expEvaled = Agg (up, down))
136- }
137- test(" anonTriple" ) {
138- import anonTriple ._
139- val check = new Checker (anonTriple)
140- val middle = down.inputs(0 )
141- check(down, expValue = 0 , expEvaled = Agg (up, middle, down))
142-
143- down.counter += 1
144- check(down, expValue = 1 , expEvaled = Agg (middle, down))
145-
146- up.counter += 1
147- check(down, expValue = 2 , expEvaled = Agg (up, middle, down))
148-
149- middle.asInstanceOf [TestUtil .Test ].counter += 1
150-
151- check(down, expValue = 3 , expEvaled = Agg (middle, down))
152- }
153- test(" diamond" ) {
154- import diamond ._
155- val check = new Checker (diamond)
156- check(down, expValue = 0 , expEvaled = Agg (up, left, right, down))
157-
158- down.counter += 1
159- check(down, expValue = 1 , expEvaled = Agg (down))
160-
161- up.counter += 1
162- // Increment by 2 because up is referenced twice: once by left once by right
163- check(down, expValue = 3 , expEvaled = Agg (up, left, right, down))
164-
165- left.counter += 1
166- check(down, expValue = 4 , expEvaled = Agg (left, down))
107+ val checker = new Checker (canOverrideSuper)
108+ checker(foo, Seq (" base" , " object" ), Agg (foo), extraEvaled = - 1 )
167109
168- right.counter += 1
169- check(down, expValue = 5 , expEvaled = Agg (right, down))
170- }
171- test(" anonDiamond" ) {
172- import anonDiamond ._
173- val check = new Checker (anonDiamond)
174- val left = down.inputs(0 ).asInstanceOf [TestUtil .Test ]
175- val right = down.inputs(1 ).asInstanceOf [TestUtil .Test ]
176- check(down, expValue = 0 , expEvaled = Agg (up, left, right, down))
177-
178- down.counter += 1
179- check(down, expValue = 1 , expEvaled = Agg (left, right, down))
180-
181- up.counter += 1
182- // Increment by 2 because up is referenced twice: once by left once by right
183- check(down, expValue = 3 , expEvaled = Agg (up, left, right, down))
184-
185- left.counter += 1
186- check(down, expValue = 4 , expEvaled = Agg (left, right, down))
187-
188- right.counter += 1
189- check(down, expValue = 5 , expEvaled = Agg (left, right, down))
190- }
191-
192- test(" bigSingleTerminal" ) {
193- import bigSingleTerminal ._
194- val check = new Checker (bigSingleTerminal)
195-
196- check(j, expValue = 0 , expEvaled = Agg (a, b, e, f, i, j), extraEvaled = 22 )
197-
198- j.counter += 1
199- check(j, expValue = 1 , expEvaled = Agg (j), extraEvaled = 3 )
200-
201- i.counter += 1
202- // increment value by 2 because `i` is used twice on the way to `j`
203- check(j, expValue = 3 , expEvaled = Agg (j, i), extraEvaled = 8 )
204-
205- b.counter += 1
206- // increment value by 4 because `b` is used four times on the way to `j`
207- check(j, expValue = 7 , expEvaled = Agg (b, e, f, i, j), extraEvaled = 20 )
208- }
110+ val public = os.read(checker.evaluator.outPath / " foo.json" )
111+ val overridden = os.read(
112+ checker.evaluator.outPath / " foo.super/BaseModule.json"
113+ )
114+ assert(
115+ public.contains(" base" ),
116+ public.contains(" object" ),
117+ overridden.contains(" base" ),
118+ ! overridden.contains(" object" )
119+ )
209120 }
121+ test(" overrideSuperCommand" ) {
122+ // Make sure you can override commands, call their supers, and have the
123+ // overridden command be allocated a spot within the super/ folder of
124+ // the main publicly-available command
125+ import canOverrideSuper ._
210126
211- test(" evaluateMixed" ) {
212- test(" separateGroups" ) {
213- // Make sure that `left` and `right` are able to recompute separately,
214- // even though one depends on the other
215-
216- import separateGroups ._
217- val checker = new Checker (separateGroups)
218- val evaled1 = checker.evaluator.evaluate(Agg (right, left))
219- val filtered1 = evaled1.evaluated.filter(_.isInstanceOf [TargetImpl [_]])
220- assert(filtered1.toSeq.sortBy(_.toString) == Seq (change, left, right).sortBy(_.toString))
221- val evaled2 = checker.evaluator.evaluate(Agg (right, left))
222- val filtered2 = evaled2.evaluated.filter(_.isInstanceOf [TargetImpl [_]])
223- assert(filtered2 == Agg ())
224- change.counter += 1
225- val evaled3 = checker.evaluator.evaluate(Agg (right, left))
226- val filtered3 = evaled3.evaluated.filter(_.isInstanceOf [TargetImpl [_]])
227- assert(filtered3 == Agg (change, right))
228-
229- }
230- test(" triangleTask" ) {
231-
232- import triangleTask ._
233- val checker = new Checker (triangleTask)
234- checker(right, 3 , Agg (left, right), extraEvaled = - 1 )
235- checker(left, 1 , Agg (), extraEvaled = - 1 )
236-
237- }
238- test(" multiTerminalGroup" ) {
239- import multiTerminalGroup ._
240-
241- val checker = new Checker (multiTerminalGroup)
242- checker(right, 1 , Agg (right), extraEvaled = - 1 )
243- checker(left, 1 , Agg (left), extraEvaled = - 1 )
244- }
245-
246- test(" multiTerminalBoundary" ) {
247-
248- import multiTerminalBoundary ._
249-
250- val checker = new Checker (multiTerminalBoundary)
251- checker(task2, 4 , Agg (right, left), extraEvaled = - 1 , secondRunNoOp = false )
252- checker(task2, 4 , Agg (), extraEvaled = - 1 , secondRunNoOp = false )
253- }
254-
255- test(" overrideSuperTask" ) {
256- // Make sure you can override targets, call their supers, and have the
257- // overridden target be allocated a spot within the overridden/ folder of
258- // the main publicly-available target
259- import canOverrideSuper ._
260-
261- val checker = new Checker (canOverrideSuper)
262- checker(foo, Seq (" base" , " object" ), Agg (foo), extraEvaled = - 1 )
263-
264- val public = os.read(checker.evaluator.outPath / " foo.json" )
265- val overridden = os.read(
266- checker.evaluator.outPath / " foo.super/BaseModule.json"
267- )
268- assert(
269- public.contains(" base" ),
270- public.contains(" object" ),
271- overridden.contains(" base" ),
272- ! overridden.contains(" object" )
273- )
274- }
275- test(" overrideSuperCommand" ) {
276- // Make sure you can override commands, call their supers, and have the
277- // overridden command be allocated a spot within the super/ folder of
278- // the main publicly-available command
279- import canOverrideSuper ._
280-
281- val checker = new Checker (canOverrideSuper)
282- val runCmd = cmd(1 )
283- checker(
284- runCmd,
285- Seq (" base1" , " object1" ),
286- Agg (runCmd),
287- extraEvaled = - 1 ,
288- secondRunNoOp = false
289- )
127+ val checker = new Checker (canOverrideSuper)
128+ val runCmd = cmd(1 )
129+ checker(
130+ runCmd,
131+ Seq (" base1" , " object1" ),
132+ Agg (runCmd),
133+ extraEvaled = - 1 ,
134+ secondRunNoOp = false
135+ )
290136
291- val public = os.read(checker.evaluator.outPath / " cmd.json" )
292- val overridden = os.read(
293- checker.evaluator.outPath / " cmd.super/BaseModule.json"
294- )
295- assert(
296- public.contains(" base1" ),
297- public.contains(" object1" ),
298- overridden.contains(" base1" ),
299- ! overridden.contains(" object1" )
300- )
301- }
137+ val public = os.read(checker.evaluator.outPath / " cmd.json" )
138+ val overridden = os.read(
139+ checker.evaluator.outPath / " cmd.super/BaseModule.json"
140+ )
141+ assert(
142+ public.contains(" base1" ),
143+ public.contains(" object1" ),
144+ overridden.contains(" base1" ),
145+ ! overridden.contains(" object1" )
146+ )
302147 }
303148 test(" stackableOverrides" ) {
304149 // Make sure you can override commands, call their supers, and have the
0 commit comments