Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug fixes and unit tests to validate behavior of various command line flags and their combinations:
--exec
,--yaml-out
,--yaml-stream
,--multi
,--output-file
. I also propagated thestd: Std
argument all the way tosjsonnet.SjsonnetMain.main0
, so it can easily be passed in by people who use the CLI-arg-based programmatic interface without having to drop down intosjsonnet.Interpreter
, e.g. in Databricks'JsonnetWorker
Fixes #112, and fixes #77, and adds tests for #60 (which was already working before, but without test coverage)
The logic inside
SjsonnetMain.scala
is still pretty messy, but at least it has some rudimentary unit tests now.Another thing to note is that trailing newline handling isn't great; depending on what code path you go through, you may get zero, one, or two trailing newlines. That should be benign, since trailing newlines are not semantically meaningful in either JSON or YAML, so for now I just left them in place. At least now we have tests to surface some of the weirdness
I had to move
MainTests.scala
fromsrc-jvm-native/
tosrc-jvm/
, due to weird crashes in the Scala Native test-running infrastructure. Given the experimental nature of Scala-Native, losing a bit of coverage is probably OK for now, and also it's unlikely that this will cause anything to break given the same code receives test coverage on the JVM.