@@ -18,19 +18,19 @@ class ClasspathTests:
1818 val packBinDir = " dist/target/pack/bin"
1919 val packLibDir = " dist/target/pack/lib"
2020
21- // only interested in classpath test scripts
22- val testScriptName = " classpathReport.sc"
23- val testScript = scripts(" /scripting" ).find { _.getName.matches(testScriptName) } match
24- case None => sys.error(s " test script not found: ${testScriptName}" )
25- case Some (file) => file
26-
2721 def exists (scriptPath : Path ): Boolean = Files .exists(scriptPath)
2822 def packBinScalaExists : Boolean = exists(Paths .get(s " $packBinDir/scala " ))
2923
3024 /*
3125 * verify classpath reported by called script.
3226 */
3327 @ Test def hashbangClasspathVerifyTest = {
28+ // only interested in classpath test scripts
29+ val testScriptName = " classpathReport.sc"
30+ val testScript = scripts(" /scripting" ).find { _.getName.matches(testScriptName) } match
31+ case None => sys.error(s " test script not found: ${testScriptName}" )
32+ case Some (file) => file
33+
3434 val relpath = testScript.toPath.relpath.norm
3535 printf(" ===> hashbangClasspathVerifyTest for script [%s]\n " , relpath)
3636 printf(" bash is [%s]\n " , bashExe)
@@ -57,6 +57,32 @@ class ClasspathTests:
5757
5858 assert(hashbangClasspathJars.size == packlibJars.size)
5959 }
60+ /*
61+ * verify classpath is unglobbed by MainGenericRunner.
62+ */
63+ @ Test def unglobClasspathVerifyTest = {
64+ val testScriptName = " unglobClasspath.sc"
65+ val testScript = scripts(" /scripting" ).find { _.getName.matches(testScriptName) } match
66+ case None => sys.error(s " test script not found: ${testScriptName}" )
67+ case Some (file) => file
68+
69+ val relpath = testScript.toPath.relpath.norm
70+ printf(" ===> unglobClasspathVerifyTest for script [%s]\n " , relpath)
71+ printf(" bash is [%s]\n " , bashExe)
72+
73+ if packBinScalaExists then
74+ val bashCmdline = s " SCALA_OPTS= $relpath"
75+ val cmd = Array (bashExe, " -c" , bashCmdline)
76+
77+ cmd.foreach { printf(" [%s]\n " , _) }
78+
79+ // test script reports the classpath it sees
80+ val scriptOutput = exec(cmd:_* )
81+ val scriptCp = findTaggedLine(" unglobbed classpath" , scriptOutput)
82+ val classpathJars = scriptCp.split(psep).map { _.getName }.sorted.distinct
83+ // classpathJars.foreach { printf("%s\n", _) }
84+ assert(classpathJars.size > 1 )
85+ }
6086
6187
6288// ////////////// end of tests ////////////////
0 commit comments