Groovy Multiline String Doesn't Recognize Lines with Only Whitespaces -


i'm guessing known issue , there's efficient workaround somehow.

i getting output has lines in contain fixed number of empty spaces. i'm doing string comparison test such 1 below part of unit test. there way pass without modifying strings using stripindent() or like?

note, test below supposed have 4 white spaces in seemingly empty line between teststart , testend in multiline string. however, stack overflow may removing it?

string singleline = 'teststart\n    \ntestend'  string multiline = ''' teststart  testend '''  println singleline println multiline assert singleline == multiline 

string singleline = 'teststart\n    \ntestend'  string multiline = ''' teststart (assume there 4 spaces on line) testend '''  println singleline println multiline assert singleline == multiline 

that assertion supposed fail. first character in singleline character t teststart. first character in multiline newline character because string begins after opening ''' , first character have after newline character. have same issue @ end of string. solve in couple of ways:

string multiline = '''\ teststart (assume there 4 spaces on line) testend\ ''' 

or:

string multiline = '''teststart (assume there 4 spaces on line) testend''' 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -