Skip to content
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

Tapiro core tests #211

Merged
merged 4 commits into from
Apr 10, 2020
Merged

Tapiro core tests #211

merged 4 commits into from
Apr 10, 2020

Conversation

gabro
Copy link
Member

@gabro gabro commented Mar 27, 2020

Based on #210, only the last commit is relevant.

TODO

  • add more tests if we like the approach
  • add a NOTICE for the code I've copy-pasted from Metals
  • logs are not displayed when running the sbt plugin

@kanbanbot kanbanbot added the WIP label Mar 27, 2020
@gabro gabro requested a review from calippo March 27, 2020 14:57
@kanbanbot kanbanbot added in review and removed WIP labels Mar 27, 2020
@gabro gabro requested a review from tpetrucciani March 27, 2020 14:57
@@ -0,0 +1,58 @@
package io.buildo.tapiro
Copy link
Member Author

Choose a reason for hiding this comment

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

this file is copy-pasted from Metals almost verbatim


class TapiroSuite extends munit.FunSuite {

check(
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a test, the idea is that you pass in the controller code and the test runs tapiro and checks the expected code against the generated one.

|}
|""".stripMargin,
"""
|/src/main/scala/schools/endpoints/SchoolControllerTapirEndpoints.scala
Copy link
Member Author

Choose a reason for hiding this comment

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

line starting with a single / declare files that are written to disk (in a temp dir)

import Formatter.format

val logger = LogManager.getLogger("io.buildo.tapiro")
Copy link
Member Author

Choose a reason for hiding this comment

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

this does not show up when running the sbt plugin, I'll open a separate issue for it

tpetrucciani
tpetrucciani previously approved these changes Apr 1, 2020
Copy link
Contributor

@tpetrucciani tpetrucciani left a comment

Choose a reason for hiding this comment

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

💯

@tpetrucciani
Copy link
Contributor

I've tried to rebase my PR #212 on this and add more tests (not pushed yet).

I think it works quite nicely so I'd be in favour of merging this as is (bar the conflict to fix) and keep the "add more tests" part for #212 since tests on POST endpoints would have to be updated anyway. @gabro what do you think?

@calippo did you get a chance to look at this?

@gabro
Copy link
Member Author

gabro commented Apr 10, 2020

I'm 👍 for merging it as is. This needs a rebase, but it should be easy.

@calippo
Copy link
Member

calippo commented Apr 10, 2020

I had a quick look, lgtm

@calippo calippo removed their request for review April 10, 2020 14:59
@gabro
Copy link
Member Author

gabro commented Apr 10, 2020

Rebased, we can merge as soon as the CI passes

@gabro gabro merged commit 09b065d into master Apr 10, 2020
@gabro gabro deleted the tapiro-core-tests branch April 10, 2020 15:51
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.

4 participants