-
Notifications
You must be signed in to change notification settings - Fork 63
gradle: fix test target for cli, examples, pts #351
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -112,4 +112,13 @@ class CliTest { | |||||||
|
||||||||
assertEquals("<<{'a': 1}>>", actual) | ||||||||
} | ||||||||
|
||||||||
@Test | ||||||||
fun withPartiQLPrettyOutput() { | ||||||||
val subject = makeCli("SELECT * FROM input_data", "{a: 1, b: 2}", | ||||||||
outputFormat = OutputFormat.PARTIQL_PRETTY) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: could move onto the same line as the previous test
Suggested change
|
||||||||
val actual = subject.runAndOutput() | ||||||||
|
||||||||
assertEquals("<<\n {\n 'a': 1,\n 'b': 2\n }\n>>", actual) | ||||||||
} | ||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package org.partiql.examples | ||
|
||
import kotlin.test.* | ||
import com.amazon.ion.system.* | ||
import org.partiql.examples.util.Example | ||
import org.partiql.lang.ast.* | ||
import org.partiql.lang.domains.PartiqlAst | ||
import org.partiql.lang.syntax.* | ||
import java.io.PrintStream | ||
import java.util.Objects | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: unused import There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops thanks sorry; This was a stray import from a previous edit. |
||
|
||
/** | ||
* Demonstrates the use of [SqlParser] and [PartiqlAst]. | ||
|
@@ -45,7 +45,9 @@ class ParserExample(out: PrintStream) : Example(out) { | |
// version of the s-expression form to an instance of [ExprNode]. | ||
val deserializedAst = serializedAst.toExprNode(ion) | ||
// Verify that we have the correct AST. | ||
assertEquals(originalAst, deserializedAst) | ||
if (originalAst != deserializedAst) { | ||
throw Exception("expected AST to be equal") | ||
} | ||
Comment on lines
+47
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we instead use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason was to avoid requiring the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for explaining. In that case, ignore my comments for this file on using |
||
|
||
// Here we show how to parse a query directly to a PartiqlAst statement | ||
val statement = parser.parseAstStatement(query) | ||
|
@@ -55,6 +57,8 @@ class ParserExample(out: PrintStream) : Example(out) { | |
// and back into a PartiqlAst statement | ||
val roundTrippedStatement = PartiqlAst.transform(elements) as PartiqlAst.Statement | ||
// Verify that we have the original Partiql Ast statement | ||
assertEquals(statement, roundTrippedStatement) | ||
if (statement != roundTrippedStatement) { | ||
throw Exception("Expected statements to be the same") | ||
} | ||
Comment on lines
+59
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same argument here concerning |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,17 +48,12 @@ dependencies { | |
api 'org.partiql:partiql-ir-generator-runtime:0.3.0' | ||
|
||
// test-time dependencies | ||
testImplementation 'org.jetbrains.kotlin:kotlin-reflect' | ||
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit5' | ||
testImplementation 'pl.pragmatists:JUnitParams:[1.0.0,1.1.0)' | ||
testImplementation 'org.assertj:assertj-core:[3.11.0,3.12.0)' | ||
|
||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need this dependency to run junit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops nice catch thanks! This is probably why I should not make wholesale changes without understanding what I am actually doing :) |
||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' | ||
testImplementation 'org.junit.vintage:junit-vintage-engine:5.7.0' | ||
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.7.0' | ||
// PTS | ||
testImplementation project(':testscript') | ||
Comment on lines
-60
to
-61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this dependency breaking anything? This (I believe) is what hooks into the PTS (included in this repo) system which runs more tests focusing on spec compliance. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was not breaking anything, but it seems to be unnecessary as the code builds without it? I haven't read the code in detail, but it appears to me that the dependency tree is that the I barely understand this though; I just was curious if all these dependencies were actually needed. I will revert my changes to this file: the important updates are to |
||
} | ||
|
||
task generatePigDomains { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this plugin removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand gradle. I assumed since this file has no references to it, this is unnecessary?
The top level
build.gradle
referencesdetekt
, and I assumed theapply plugin
thing attempts to apply the plugin to all subprojects? If so, doesn't that mean this is unnecessary, since the top level project includes it?FWIW, with this change, the
./gradlew cli:detekt
task still seems to work?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also don't understand gradle too well. You seem to be right regarding the top level references to
detekt
, which is applied to all the subprojects. Since thedetekt
plugin isn't referenced in the other subprojects, could you also remove thedetekt
plugin fromThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, done, thanks.