Skip to content

Improve tooling and sbt-plugin error handling #144

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 3 commits into from
Aug 4, 2018
Merged

Conversation

jonas
Copy link
Member

@jonas jonas commented Aug 2, 2018

Supersedes #142 (except for the config change).


result match {
case Right(binding) =>
binding.writeToFile(outputFile)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion is to eventually remove error emitting code from these tests so we can add assert(binding.errors.isEmpty) here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we still want to check what bindings are generated if a header file cannot be perfectly converted to Scala code.
For example we check that literal define is skipped if its value does not fit into Scala type.
Even if we check in BindgenReportingSpec that warning is printed for this case it does not guarantee that the code is not outputted.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming these are edge cases it could still make sense to have them in the reporting spec.

@@ -52,7 +53,7 @@ sealed trait Bindgen {
/**
* Run binding generator
*/
def generate(): Bindings
def generate(): Either[Seq[String], Bindings]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Also maybe update the comment:

/**
 * Run binding generator
 * @return errors if exit code was not 0, otherwise return bindings
 */

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, thanks. Done.

@@ -33,51 +33,57 @@ class BindgenReportingSpec extends FunSpec {
.excludePrefix("__")
.generate()

result match {
case Right(binding) => assert(binding.errors == errors)
case Left(bindingErrors) => assert(bindingErrors == errors)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should fail test if case Left

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, done

@kornilova203 kornilova203 merged commit 64eb1c6 into master Aug 4, 2018
@kornilova203 kornilova203 deleted the error-handling branch August 4, 2018 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants