Skip to content

Commit

Permalink
Add test for quotes within quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
tstirrat15 committed Jan 16, 2025
1 parent 01c133f commit f28fc8f
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/composableschemadsl/parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ func TestParser(t *testing.T) {
{"caveat with keyword parameter test", "caveatwithkeywordparam"},
{"local imports test", "localimport"},
{"local imports with singlequotes on import test", "localimport_with_singlequotes"},
{"local imports with quotes within quotes on import test", "localimport_with_quotes_in_quotes"},
{"local imports with unterminated string on import test", "localimport_with_unterminated_string"},
{"local imports with mismatched quotes on import test", "localimport_with_mismatched_quotes"},
{"local imports with keyword in import path test", "localimport_import_path_with_keyword"},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// NOTE: this is mostly to validate parser behavior; this path
// would be treated as invalid by the compiler/importer.
import """path/to/'"user.zed"""

definition resource {
relation user: user
relation persona: persona
permission view = user + persona
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
NodeTypeFile
end-rune = 267
input-source = local imports with quotes within quotes on import test
start-rune = 0
child-node =>
NodeTypeImport
end-rune = 150
import-path = path/to/'"user.zed
input-source = local imports with quotes within quotes on import test
start-rune = 120
child-node =>
NodeTypeComment
comment-value = // NOTE: this is mostly to validate parser behavior; this path
NodeTypeComment
comment-value = // would be treated as invalid by the compiler/importer.
NodeTypeDefinition
definition-name = resource
end-rune = 266
input-source = local imports with quotes within quotes on import test
start-rune = 153
child-node =>
NodeTypeRelation
end-rune = 197
input-source = local imports with quotes within quotes on import test
relation-name = user
start-rune = 179
allowed-types =>
NodeTypeTypeReference
end-rune = 197
input-source = local imports with quotes within quotes on import test
start-rune = 194
type-ref-type =>
NodeTypeSpecificTypeReference
end-rune = 197
input-source = local imports with quotes within quotes on import test
start-rune = 194
type-name = user
NodeTypeRelation
end-rune = 227
input-source = local imports with quotes within quotes on import test
relation-name = persona
start-rune = 203
allowed-types =>
NodeTypeTypeReference
end-rune = 227
input-source = local imports with quotes within quotes on import test
start-rune = 221
type-ref-type =>
NodeTypeSpecificTypeReference
end-rune = 227
input-source = local imports with quotes within quotes on import test
start-rune = 221
type-name = persona
NodeTypePermission
end-rune = 264
input-source = local imports with quotes within quotes on import test
relation-name = view
start-rune = 233
compute-expression =>
NodeTypeUnionExpression
end-rune = 264
input-source = local imports with quotes within quotes on import test
start-rune = 251
left-expr =>
NodeTypeIdentifier
end-rune = 254
identifier-value = user
input-source = local imports with quotes within quotes on import test
start-rune = 251
right-expr =>
NodeTypeIdentifier
end-rune = 264
identifier-value = persona
input-source = local imports with quotes within quotes on import test
start-rune = 258

0 comments on commit f28fc8f

Please sign in to comment.