-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from cassandra-scala/feature/127-cql3.3-specs
Adds specs for escaping characters
- Loading branch information
Showing
8 changed files
with
55 additions
and
18 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
cql-parser/src/main/scala/troy/cql/parser/dml/SelectStatementParser.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
cql-parser/src/test/scala/troy/cql3_3/lexical/EscapingCharactersParsingSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package troy.cql3_3.lexical | ||
|
||
import org.scalatest.{ FlatSpec, Matchers } | ||
import troy.cql.ast.StringConstant | ||
import troy.cql.parser.ParserTestUtils.InsertUtils._ | ||
|
||
// http://docs.datastax.com/en/cql/3.3/cql/cql_reference/escape_char_r.html | ||
class EscapingCharactersParsingSpec extends FlatSpec with Matchers { | ||
"single quotation in string literal" should "be escaped by duplicate single quotation mark" in { | ||
parse( | ||
""" | ||
| INSERT INTO cycling.calendar (race_id, race_start_date, race_end_date, race_name) VALUES | ||
| (201, '2015-02-18', '2015-02-22', 'Women''s Tour of New Zealand'); | ||
""".stripMargin | ||
).values(3) shouldBe StringConstant("Women's Tour of New Zealand") | ||
} | ||
|
||
// TODO: https://github.com/cassandra-scala/troy/issues/130 | ||
it should "be escaped by duplicate dollar signs" ignore { | ||
parse( | ||
""" | ||
| INSERT INTO cycling.calendar (race_id, race_start_date, race_end_date, race_name) VALUES | ||
| (201, '2015-02-18', '2015-02-22', $$Women's Tour of New Zealand$$); | ||
""".stripMargin | ||
).values(3) shouldBe StringConstant("Women's Tour of New Zealand") | ||
} | ||
|
||
} |