Skip to content

Fix issue #8124 #8279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/config/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ object Settings {
update(output, args)
}
case (StringTag, arg2 :: args2) =>
update(arg2, args2)
if (arg2 startsWith "-") missingArg
else update(arg2, args2)
case (IntTag, arg2 :: args2) =>
try {
val x = arg2.toInt
Expand Down
10 changes: 10 additions & 0 deletions compiler/test/dotty/tools/dotc/SettingsTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,14 @@ class SettingsTests {
assertEquals(0, reporter.errorCount)
assertTrue(Files.exists(out))
}

@Test def t8124: Unit = {
val source = Paths.get("tests/pos/Foo.scala").normalize
val outputDir = Paths.get("out/testSettings").normalize
if (Files.notExists(outputDir)) Files.createDirectory(outputDir)
val options = Array("-encoding", "-d", outputDir.toString, source.toString)
val reporter = Main.process(options)
assertEquals(1, reporter.errorCount)
}

}
18 changes: 18 additions & 0 deletions doc-tool/test/dotty/tools/dottydoc/SettingsTests.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package dotty.tools
package dottydoc

import org.junit.Test
import org.junit.Assert._

class SettingsTests {

@Test def t8124: Unit = {
val source = "tests/pos/Foo.scala"
val url = "https://github.com/lampepfl/dotty/tree/master/tests"
val options = Array("-project", "-project-url", url, source)
val reporter = Main.process(options)
assertEquals(2, reporter.errorCount)
assertEquals("missing argument for option -project", reporter.allErrors.last.message)
}

}