blob: 1bf7ae60b284c05136272f145c0a7334f05bbf9b [file] [log] [blame]
package groovy
class HeredocsTest extends GroovyTestCase {
void testHeredocs() {
def name = "James"
def s = """
abcd
efg
hijk
hello ${name}
"""
assert s != null
assert s instanceof GString
assert s.contains("i")
assert s.contains("James")
def numlines = s.count('\n')
assert numlines == 8
}
void testDollarEscaping() {
def s = """
hello \${name}
"""
assert s != null
assert s.contains('$')
def c = s.count('$')
assert c == 1
assert s == '\nhello ${name}\n'
}
}