Skip to content

Add snapshot / unit tests #27

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 4 commits into from
May 24, 2019
Merged

Conversation

PanAeon
Copy link
Contributor

@PanAeon PanAeon commented May 23, 2019

Hi,
I have added some basic unit tests and also some snapshot tests.
Almost all of the code examples I took from the scala spec.

Related Issue #26

Copy link
Contributor

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

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

Fantastic work! I am very excited about having tests, this will make code reviewing changes in the future much easier :)

The text format of the assertions is nice, very easy to read. I am wondering, would it be possible to auto-generate the assertions given a plain Scala source file? We might be able to use the auto-generated assertion files as expect outputs instead of the JSON files. Expect tests should ideally have human readable output files so that the diffs are easier to review.

@PanAeon
Copy link
Contributor Author

PanAeon commented May 23, 2019

Well, yes. This is what I tried to do at first attempt :) But I think I got some aggregation wrong and end up having overlapping tokens, then I abandoned the idea. Now I looked at it again and I think it's totaly possible. This is how it's gonna look like:

>in  { home       = "/home/${user}"
#^^ source.dhall keyword.control.dhall
#  ^^ source.dhall
#    ^ source.dhall meta.declaration.data.record.block.dhall keyword.operator.record.begin.dhall
#     ^ source.dhall meta.declaration.data.record.block.dhall
#      ^^^^ source.dhall meta.declaration.data.record.block.dhall variable.object.property.dhall
#          ^^^^^^^ source.dhall meta.declaration.data.record.block.dhall
#                 ^ source.dhall meta.declaration.data.record.block.dhall meta.declaration.data.record.literal.dhall punctuation.separator.dictionary.key-value.dhall
#                  ^ source.dhall meta.declaration.data.record.block.dhall meta.declaration.data.record.literal.dhall
#                   ^ source.dhall meta.declaration.data.record.block.dhall meta.declaration.data.record.literal.dhall string.quoted.double.dhall
#                    ^^^^^^ source.dhall meta.declaration.data.record.block.dhall meta.declaration.data.record.literal.dhall string.quoted.double.dhall
#                          ^^ source.dhall meta.declaration.data.record.block.dhall meta.declaration.data.record.literal.dhall string.quoted.double.dhall constant.other.placeholder.dhall punctuation.section.curly.begin.dhall
#                            ^^^^ source.dhall meta.declaration.data.record.block.dhall meta.declaration.data.record.literal.dhall string.quoted.double.dhall constant.other.placeholder.dhall meta.abel.dhall
#                                ^ source.dhall meta.declaration.data.record.block.dhall meta.declaration.data.record.literal.dhall string.quoted.double.dhall constant.other.placeholder.dhall punctuation.section.curly.end.dhall
#                                 ^ source.dhall meta.declaration.data.record.block.dhall meta.declaration.data.record.literal.dhall string.quoted.double.dhall

I'll update this pull request once I finished

Copy link
Contributor

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thank you @PanAeon for your hard work.

@@ -0,0 +1,495 @@
>
>object ExampleIdentifiers {
#^^^^^^ source.scala keyword.declaration.scala
Copy link
Contributor

Choose a reason for hiding this comment

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

😍 This looks great!

@olafurpg olafurpg requested a review from nicolasstucki May 24, 2019 08:39
@olafurpg olafurpg merged commit 17a7bdb into scala:master May 24, 2019
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.

3 participants