Skip to content

Commit

Permalink
Add some more string tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross35 committed Jul 30, 2024
1 parent 8d0a392 commit 667a4b0
Show file tree
Hide file tree
Showing 2 changed files with 258 additions and 192 deletions.
258 changes: 258 additions & 0 deletions test/corpus/delimited.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
================================================================================
basic strings
================================================================================

foo := "a"
bar := "b
c
"
baz := "a\"\t"

--------------------------------------------------------------------------------

(source_file
(assignment
(identifier)
(expression
(value
(string))))
(assignment
(identifier)
(expression
(value
(string))))
(assignment
(identifier)
(expression
(value
(string
(escape_sequence)
(escape_sequence))))))

================================================================================
escape newlines
================================================================================

foo := "a\
b"

--------------------------------------------------------------------------------

(source_file
(assignment
(identifier)
(expression
(value
(string
(escape_sequence))))))

================================================================================
indented basic strings
================================================================================

foo := """a"""
bar:= """b
c
"""
baz := """
abc \t
def \"
"""

--------------------------------------------------------------------------------

(source_file
(assignment
(identifier)
(expression
(value
(string))))
(assignment
(identifier)
(expression
(value
(string))))
(assignment
(identifier)
(expression
(value
(string
(escape_sequence)
(escape_sequence))))))

================================================================================
indented with nested delim
================================================================================

foo := """ a " b """
bar:= """b
"baz"
"""

--------------------------------------------------------------------------------

(source_file
(ERROR
(identifier)
(text)
(text)
(text)
(text)))

================================================================================
raw strings
================================================================================

foo := 'a'
bar := 'b
c
'
baz := 'a\"\t'

--------------------------------------------------------------------------------

(source_file
(assignment
(identifier)
(expression
(value
(string))))
(assignment
(identifier)
(expression
(value
(string))))
(assignment
(identifier)
(expression
(value
(string)))))

================================================================================
indented raw strings
================================================================================

foo := '''a'''
bar:= '''b
c
'''
baz := ''''
abc \t
def \"
'''

--------------------------------------------------------------------------------

(source_file
(assignment
(identifier)
(expression
(value
(string))))
(assignment
(identifier)
(expression
(value
(string))))
(assignment
(identifier)
(expression
(value
(string)))))

================================================================================
indented raw with nested delim
================================================================================

foo := ''' a ' '''
bar:= '''b
'baz'
'''

--------------------------------------------------------------------------------

(source_file
(assignment
(identifier)
(expression
(value
(string))))
(assignment
(identifier)
(expression
(value
(string)))))

================================================================================
backticks
================================================================================

foo := `echo hi`
bar := `echo hi
echo bye
`

--------------------------------------------------------------------------------

(source_file
(assignment
(identifier)
(expression
(value
(external_command
(command_body)))))
(assignment
(identifier)
(expression
(value
(external_command
(command_body))))))

================================================================================
indented backticks
================================================================================

foo := ```echo hi```
bar := ```
echo bye
```
--------------------------------------------------------------------------------

(source_file
(assignment
(identifier)
(expression
(value
(external_command
(command_body)))))
(assignment
(identifier)
(expression
(value
(external_command
(command_body))))))

================================================================================
indented backticks with nested delim
================================================================================

foo := ``` a ` ```
bar:= ```b
`baz`
```

--------------------------------------------------------------------------------

(source_file
(assignment
(identifier)
(expression
(value
(external_command
(command_body)))))
(assignment
(identifier)
(expression
(value
(external_command
(command_body))))))
Loading

0 comments on commit 667a4b0

Please sign in to comment.