@@ -33,42 +33,48 @@ class SourcesTests extends munit.FunSuite {
33
33
() => sys.error(" shouldn't be used" )
34
34
)
35
35
36
- test(" dependencies in .scala - using" ) {
37
- val testInputs = TestInputs (
38
- os.rel / " something.scala" ->
39
- """ //> using deps "org1:name1:1.1", "org2::name2:2.2"
40
- |//> using dep "org3:::name3:3.3"
41
- |import scala.collection.mutable
42
- |
43
- |object Something {
44
- | def a = 1
45
- |}
46
- |""" .stripMargin
47
- )
48
- val expectedDeps = Seq (
49
- dep " org3:::name3:3.3 " ,
50
- dep " org1:name1:1.1 " ,
51
- dep " org2::name2:2.2 "
52
- )
53
- testInputs.withInputs { (_, inputs) =>
54
- val (crossSources, _) =
55
- CrossSources .forInputs(
56
- inputs,
57
- preprocessors,
58
- TestLogger (),
59
- suppressDirectivesInMultipleFilesWarning = None
60
- ).orThrow
61
- val scopedSources = crossSources.scopedSources(BuildOptions ()).orThrow
62
- val sources = scopedSources.sources(Scope .Main , crossSources.sharedOptions(BuildOptions ()))
36
+ for (
37
+ (singularAlias, pluralAlias) <-
38
+ List ((" lib" , " libs" ), (" dep" , " deps" ), (" dependency" , " dependencies" ))
39
+ )
40
+ test(s " dependencies in .scala - using aliases: $pluralAlias and $singularAlias" ) {
41
+ val testInputs = TestInputs (
42
+ os.rel / " something.scala" ->
43
+ s """ //> using $pluralAlias "org1:name1:1.1", "org2::name2:2.2"
44
+ |//> using $singularAlias "org3:::name3:3.3"
45
+ |import scala.collection.mutable
46
+ |
47
+ |object Something {
48
+ | def a = 1
49
+ |}
50
+ | """ .stripMargin
51
+ )
52
+ val expectedDeps = Seq (
53
+ dep " org1:name1:1.1 " ,
54
+ dep " org2::name2:2.2 " ,
55
+ dep " org3:::name3:3.3 "
56
+ )
57
+ testInputs.withInputs { (_, inputs) =>
58
+ val (crossSources, _) =
59
+ CrossSources .forInputs(
60
+ inputs,
61
+ preprocessors,
62
+ TestLogger (),
63
+ suppressDirectivesInMultipleFilesWarning = None
64
+ ).orThrow
65
+ val scopedSources = crossSources.scopedSources(BuildOptions ()).orThrow
66
+ val sources = scopedSources.sources(Scope .Main , crossSources.sharedOptions(BuildOptions ()))
67
+
68
+ val obtainedDeps = sources.buildOptions.classPathOptions.extraDependencies.toSeq.toSeq.map(
69
+ _.value
70
+ )
63
71
64
- expect(sources.buildOptions.classPathOptions.extraDependencies.toSeq.toSeq.map(
65
- _.value
66
- ) == expectedDeps)
67
- expect(sources.paths.length == 1 )
68
- expect(sources.paths.map(_._2) == Seq (os.rel / " something.scala" ))
69
- expect(sources.inMemory.isEmpty)
72
+ expect(obtainedDeps.sortBy(_.version) == expectedDeps.sortBy(_.version))
73
+ expect(sources.paths.length == 1 )
74
+ expect(sources.paths.map(_._2) == Seq (os.rel / " something.scala" ))
75
+ expect(sources.inMemory.isEmpty)
76
+ }
70
77
}
71
- }
72
78
73
79
test(" dependencies in .scala - using witin tests" ) {
74
80
val testInputs = TestInputs (
0 commit comments