@@ -152,6 +152,58 @@ var bimodalFixtures = map[string]bimodalFixture{
152
152
"baz 1.0.0" ,
153
153
),
154
154
},
155
+ "backtrack drops transitive constraint" : {
156
+ ds : []depspec {
157
+ dsp (mkDepspec ("root 1.0.0" , "foo ^1.0.0" ),
158
+ pkg ("root" , "foo" ),
159
+ ),
160
+ dsp (mkDepspec ("foo 1.0.1" , "bar =1.0.1" , "baz =1.0.1" ), // This transitive constraint should not be applied in the final solution
161
+ pkg ("foo" , "bar" ),
162
+ ),
163
+ dsp (mkDepspec ("foo 1.0.0" , "bar =1.0.0" ),
164
+ pkg ("foo" , "bar" ),
165
+ ),
166
+ dsp (mkDepspec ("bar 1.0.1" , "baz =1.0.0-notexist" ), // This should trigger a backtrack
167
+ pkg ("bar" , "baz" ),
168
+ ),
169
+ dsp (mkDepspec ("bar 1.0.0" , "baz =1.0.0" ), // This will conflict with the transitive constraint if it's not dropped during backtracking
170
+ pkg ("bar" , "baz" ),
171
+ ),
172
+ dsp (mkDepspec ("baz 1.0.1" ), pkg ("baz" )),
173
+ dsp (mkDepspec ("baz 1.0.0" ), pkg ("baz" )),
174
+ },
175
+ r : mksolution (
176
+ "foo 1.0.0" ,
177
+ "bar 1.0.0" ,
178
+ "baz 1.0.0" ,
179
+ ),
180
+ },
181
+ "backtrack adds transitive constraint" : {
182
+ ds : []depspec {
183
+ dsp (mkDepspec ("root 1.0.0" , "foo ^1.0.0" ),
184
+ pkg ("root" , "foo" ),
185
+ ),
186
+ dsp (mkDepspec ("foo 1.0.1" , "bar =1.0.1" ),
187
+ pkg ("foo" , "bar" ),
188
+ ),
189
+ dsp (mkDepspec ("foo 1.0.0" , "bar =1.0.0" , "baz =1.0.0" ), // This transitive constraint should be applied in the final solution
190
+ pkg ("foo" , "bar" ),
191
+ ),
192
+ dsp (mkDepspec ("bar 1.0.1" , "baz =1.0.0-notexist" ), // This should trigger a backtrack
193
+ pkg ("bar" , "baz" ),
194
+ ),
195
+ dsp (mkDepspec ("bar 1.0.0" , "baz ^1.0.0" ), // Normally this would pick baz 1.0.1 but the transitive constraint should force an older version
196
+ pkg ("bar" , "baz" ),
197
+ ),
198
+ dsp (mkDepspec ("baz 1.0.1" ), pkg ("baz" )),
199
+ dsp (mkDepspec ("baz 1.0.0" ), pkg ("baz" )),
200
+ },
201
+ r : mksolution (
202
+ "foo 1.0.0" ,
203
+ "bar 1.0.0" ,
204
+ "baz 1.0.0" ,
205
+ ),
206
+ },
155
207
// Constraints apply only if the project that declares them has a
156
208
// reachable import
157
209
"constraints activated by import" : {
0 commit comments