Change the unit test asserts so that we can see all the values in the
event of a failure. When debugging an error, it's useful to see both
the stdout and stderr for the failure. Previously we would only see
one or the other (whichever one failed the assert).
This adds a helper function BaseRuntimeTest.assertCorrectOutput.
This also removes SpecialRuntimeTestAssert, which has not been used for
2 years.
This means that if you build in an unclean source tree, you don't end up with
intermediate classes in the jar. (This hasn't broken anything that I noticed,
but it bloats the jar and I wanted to make sure it wasn't messing anything up.)
This excludes .build (the Swift runtime's build directory), target (the Java
runtime's build directory) and Swift/*.xcodeproj (which is not in the source tree
but can be created by devs who are using Xcode).
Suppress "Optional" in the output when printing a value in the tests and
some debugging messages.
This is a change in behavior in Swift 4.2 (SE-0054) that implicitly
unwrapped optionals are now seen as plain Optional at runtime, and so
print doesn't implicitly unwrap them any more.
This is in different locations on JDK 9 and up. maven-jdk-tools-wrapper
does the right thing on all JDK releases.
This was mentioned in a side comment on PR #2280.
These were skipped for the Javascript backends because they're still
too slow, but Swift is fine. (Go is also excluded from these, maybe
that's a mistake, but I don't know.)
Issue #2078 is a crash (SIGILL) inside the dotnet runtime when running on
macOS on Travis. This is intermittent, so a retry may help. Retry this
specific exit status inside runProcess.
Log the command / stdout / stderr / exit status at three places
during the C# runtime tests.
At these places we are executing subprocesses, but if those fail we
weren't logging the info that we may need to diagnose the problem.
Assert that the dotnet restore / build commands succeeded. If we
get a failure at this point, the test is obviously going to fail, and
we're masking the error by trying to push on with other commands.
BailErrorStrategy is supposed to throw an error that's different from
the ordinary recognition error, specifically so that it can be handled
differently by client code. This was not ported over from Java correctly.
Fix this by moving parseCancellation from ANTLRError to ANTLRException,
adding its RecognitionException argument, and throwing it from the
two handlers in BailErrorStrategy.
Also remove ANTLRException.cannotInvokeStartRule, which is unused.
(The Java runtime uses it when ParseTreePatternMatcher throws a generic
exception, but we don't have that.)
Change the initializer to ANTLRFileStream so that it throws any errors that
occur while reading the file. Previously, it was just dropping any errors on
the floor (inside Utils.readFile).
Remove Utils.readFile, it's not used anywhere else.
This has been ported over from the Java code, but it was deprecated there.
There's no point having it in the Swift runtime because we don't have the
legacy code to support. Also, it wasn't implemented properly, so it
never worked.
Remove {DFA,IntervalSet}.toString(_:[String?]?)
and the inits in ParserInterpreter and DFASerializer for the same reason.
Switch the unit tests to use the alternate toString(_:Vocabulary).
SwiftPM has changed its default layout for new packages (i.e. when we
use "swift package init --type executable" during the test). It now is
<projectName>/Sources/<projectName>/main.swift, so we need to adjust the
paths appropriately.
This includes a small change to print stdout as well as stderr if a
unit test fails to build. swift-build-tool takes the compiler subprocess's
stderr and puts it on stdout. *sheesh* This meant that we were losing
critical error messages.