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

Migrate to new spec #106

Merged
merged 4 commits into from
Jul 11, 2019
Merged

Migrate to new spec #106

merged 4 commits into from
Jul 11, 2019

Conversation

raganhan
Copy link
Contributor

@raganhan raganhan commented Jul 9, 2019

Migrates existing integ tests to the new spec and integrate them with the ref implementation junit test suite.

PR is fairly large and it's split into 3 commits to make it a little easier to review:

  1. Code changes to testscript fixing bugs and adding missing features
  2. actual tests migration
  3. integrating with ref impl

Original tests are still part of the build, will be removed as part of a separate PR

closes #89

raganhan added 3 commits July 9, 2019 15:41
* set_default_environment can be a file path or a struct with the
environment
* equality for struct elements were using Ion equality instead of PTS
equality
* Interpolation now accepts both $variable or ${variable} when
interpolating strings
* using absolute path for test files in errors for better error
reporting
* JUnitRunner generated name now includes the test location location along with
the test id
Migration was done mostly manually to keep the formatting as it's
important for tests to be readable. A lot of tests align parameters
which would be impossible to maintain if we used ion-java to transform
All pts tests are run through junit in the regular build
@raganhan raganhan requested review from therapon, zslayton and dlurton July 9, 2019 22:58
Copy link
Contributor

@therapon therapon left a comment

Choose a reason for hiding this comment

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

Comments on first commit.

@@ -37,18 +37,20 @@ successfully or produce an error:
Changes the default environment for the current file. The initial default environment is the empty environment.

```ion
set_default_environment::<struct, required - new default environment>
set_default_environment::<struct|string, required - new default environment>
Copy link
Contributor

Choose a reason for hiding this comment

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

I would use Path instead of string and then below this line add

where Path is a string and denotes the relative path to ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm keeping string instead of path since I'm listing the valid Ion types that can go there. I reworded the sentence on line 43 to explain what the string represents

A `for` function contains a `template` and `variableSet`. Each `test` in the template is performed once for
each `variableSet` by substituting a `variableSet`'s name/value pairs into corresponding placeholders in a `test`.
A `for` function contains a `template` and `variable_set`. Each `test` in the template is performed once for
each `variable_set` by substituting a `variable_set`'s name/value pairs into corresponding placeholders in a `test`.
Copy link
Contributor

Choose a reason for hiding this comment

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

I might be reading this wrong, placeholders are in the template right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, in each templated test. Will change to just template since "templated test" is too pedantic

var lastOffset = 0
private fun IonSequence.foldInterpolating(target: IonSequence, variables: IonStruct) =
this.fold(target) { acc, el ->
val interpolated = el.interpolate(variables)
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: why the extra local val just inline acc.add(el.interpolate(variables)) . I assume add is mutating so you cannot apply the inline one more time and get a one-liner.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the extra val was to make debugging easier, forgot to change it back. Will make it a one liner

statement: "char_length('${in}')",
expected: $result
},
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no it's a different test. Commented it out to fix some issues and forgot to uncomment...

],

variable_sets: [
{ in: "", result: (success 0 ) },
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: in Sexpressions close paren does not need an extra space, i.e., (a ). Instead write (a)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@raganhan raganhan requested a review from therapon July 11, 2019 17:18
@raganhan raganhan merged commit 3ed55a5 into master Jul 11, 2019
@raganhan raganhan deleted the migrate-to-new-spec branch July 11, 2019 18:11
almann pushed a commit that referenced this pull request Jul 30, 2019
Migrated tests from old spec to PTS spec

Also fixes a multiple PTS bugs and integrates it with the ref implementation

* set_default_environment can be a file path or a struct with the
environment
* equality for struct elements were using Ion equality instead of PTS
equality
* Interpolation now accepts both $variable or ${variable} when
interpolating strings
* using absolute path for test files in errors for better error
reporting
* JUnitRunner generated name now includes the test location location along with
the test id
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.

Migrate PTS to new spec
2 participants