@@ -165,3 +165,204 @@ fn channel_selection() {
165
165
. failure ( )
166
166
. stderr ( "ERROR: `pr1` is not installed. Please run `juliaup add pr1` to install pull request channel if available.\n " ) ;
167
167
}
168
+
169
+ #[ test]
170
+ fn manifest_version_selection ( ) {
171
+ let depot_dir = assert_fs:: TempDir :: new ( ) . unwrap ( ) ;
172
+
173
+ Command :: cargo_bin ( "juliaup" )
174
+ . unwrap ( )
175
+ . arg ( "add" )
176
+ . arg ( "1.6.2" )
177
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
178
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
179
+ . assert ( )
180
+ . success ( )
181
+ . stdout ( "" ) ;
182
+
183
+ Command :: cargo_bin ( "juliaup" )
184
+ . unwrap ( )
185
+ . arg ( "add" )
186
+ . arg ( "1.10.1" )
187
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
188
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
189
+ . assert ( )
190
+ . success ( )
191
+ . stdout ( "" ) ;
192
+
193
+ Command :: cargo_bin ( "juliaup" )
194
+ . unwrap ( )
195
+ . arg ( "add" )
196
+ . arg ( "1.11.1" )
197
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
198
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
199
+ . assert ( )
200
+ . success ( )
201
+ . stdout ( "" ) ;
202
+
203
+ Command :: cargo_bin ( "juliaup" )
204
+ . unwrap ( )
205
+ . arg ( "default" )
206
+ . arg ( "1.11.1" )
207
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
208
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
209
+ . assert ( )
210
+ . success ( )
211
+ . stdout ( "" ) ;
212
+
213
+ Command :: cargo_bin ( "julia" )
214
+ . unwrap ( )
215
+ . arg ( "-e" )
216
+ . arg ( "print(VERSION)" )
217
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
218
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
219
+ . assert ( )
220
+ . success ( )
221
+ . stdout ( "1.11.1" ) ;
222
+
223
+ let proj1_dir = assert_fs:: TempDir :: new ( ) . unwrap ( ) ;
224
+
225
+ // We are adding and then removing a package here to force generation of an actual Project.toml
226
+ Command :: cargo_bin ( "julia" )
227
+ . unwrap ( )
228
+ . arg ( "+1.10.1" )
229
+ . arg ( "-e" )
230
+ . arg ( "using Pkg; Pkg.activate(\" .\" ); Pkg.add(\" StringBuilders\" ); Pkg.rm(\" StringBuilders\" ); print(VERSION)" )
231
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
232
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
233
+ . current_dir ( & proj1_dir)
234
+ . assert ( )
235
+ . success ( )
236
+ . stdout ( "1.10.1" ) ;
237
+
238
+ // First we try this with the feature disabled
239
+ Command :: cargo_bin ( "julia" )
240
+ . unwrap ( )
241
+ . arg ( "--project=." )
242
+ . arg ( "-e" )
243
+ . arg ( "print(VERSION)" )
244
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
245
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
246
+ . current_dir ( & proj1_dir)
247
+ . assert ( )
248
+ . success ( )
249
+ . stdout ( "1.11.1" ) ;
250
+
251
+ // Now we enable the feature
252
+ Command :: cargo_bin ( "juliaup" )
253
+ . unwrap ( )
254
+ . arg ( "config" )
255
+ . arg ( "featuremanifestsupport" )
256
+ . arg ( "true" )
257
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
258
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
259
+ . assert ( )
260
+ . success ( )
261
+ . stdout ( "" ) ;
262
+
263
+ Command :: cargo_bin ( "julia" )
264
+ . unwrap ( )
265
+ . arg ( "--project=." )
266
+ . arg ( "-e" )
267
+ . arg ( "print(VERSION)" )
268
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
269
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
270
+ . current_dir ( & proj1_dir)
271
+ . assert ( )
272
+ . success ( )
273
+ . stdout ( "1.10.1" ) ;
274
+
275
+ // TODO This currently fails, but it shouldn't
276
+ Command :: cargo_bin ( "julia" )
277
+ . unwrap ( )
278
+ . arg ( "--project" )
279
+ . arg ( "-e" )
280
+ . arg ( "print(VERSION)" )
281
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
282
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
283
+ . current_dir ( & proj1_dir)
284
+ . assert ( )
285
+ . success ( )
286
+ . stdout ( "1.10.1" ) ;
287
+
288
+ Command :: cargo_bin ( "julia" )
289
+ . unwrap ( )
290
+ . arg ( "--project=@." )
291
+ . arg ( "-e" )
292
+ . arg ( "print(VERSION)" )
293
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
294
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
295
+ . current_dir ( & proj1_dir)
296
+ . assert ( )
297
+ . success ( )
298
+ . stdout ( "1.10.1" ) ;
299
+
300
+ let sub_dir1 = & proj1_dir. path ( ) . join ( "subdir1" ) ;
301
+ std:: fs:: create_dir ( & sub_dir1) . unwrap ( ) ;
302
+
303
+ Command :: cargo_bin ( "julia" )
304
+ . unwrap ( )
305
+ . arg ( "--project=." )
306
+ . arg ( "-e" )
307
+ . arg ( "print(VERSION)" )
308
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
309
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
310
+ . current_dir ( & sub_dir1)
311
+ . assert ( )
312
+ . success ( )
313
+ . stdout ( "1.11.1" ) ;
314
+
315
+ // TODO This currently fails, but it shouldn't
316
+ Command :: cargo_bin ( "julia" )
317
+ . unwrap ( )
318
+ . arg ( "--project" )
319
+ . arg ( "-e" )
320
+ . arg ( "print(VERSION)" )
321
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
322
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
323
+ . current_dir ( & sub_dir1)
324
+ . assert ( )
325
+ . success ( )
326
+ . stdout ( "1.10.1" ) ;
327
+
328
+ Command :: cargo_bin ( "julia" )
329
+ . unwrap ( )
330
+ . arg ( "--project=@." )
331
+ . arg ( "-e" )
332
+ . arg ( "print(VERSION)" )
333
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
334
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
335
+ . current_dir ( & sub_dir1)
336
+ . assert ( )
337
+ . success ( )
338
+ . stdout ( "1.10.1" ) ;
339
+
340
+ // Now we try with a Julia version that generates schema v1 manifests
341
+ let proj2_dir = assert_fs:: TempDir :: new ( ) . unwrap ( ) ;
342
+
343
+ // We are adding and then removing a package here to force generation of an actual Project.toml
344
+ Command :: cargo_bin ( "julia" )
345
+ . unwrap ( )
346
+ . arg ( "+1.6.2" )
347
+ . arg ( "-e" )
348
+ . arg ( "using Pkg; Pkg.activate(\" .\" ); Pkg.add(\" StringBuilders\" ); Pkg.rm(\" StringBuilders\" ); print(VERSION)" )
349
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
350
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
351
+ . current_dir ( & proj2_dir)
352
+ . assert ( )
353
+ . success ( )
354
+ . stdout ( "1.6.2" ) ;
355
+
356
+ // It shouldn't pick up the version from the manifest, as it isn't stored in the manifest
357
+ Command :: cargo_bin ( "julia" )
358
+ . unwrap ( )
359
+ . arg ( "--project=." )
360
+ . arg ( "-e" )
361
+ . arg ( "print(VERSION)" )
362
+ . env ( "JULIA_DEPOT_PATH" , depot_dir. path ( ) )
363
+ . env ( "JULIAUP_DEPOT_PATH" , depot_dir. path ( ) )
364
+ . current_dir ( & proj2_dir)
365
+ . assert ( )
366
+ . success ( )
367
+ . stdout ( "1.11.1" ) ;
368
+ }
0 commit comments