void () { final String in1 = """ class A { int i = 1 + 2 + 3; }"""; final String what1 = "1 + '_a+"; final String by1 = "4"; assertEquals(""" class A { int i = 4; }""", replace(in1, what1, by1)); final String by2 = "$a$"; assertEquals(""" class A { int i = 2 + 3; }""", replace(in1, what1, by2)); final String by3 = "$a$+4"; assertEquals(""" class A { int i = 2 + 3+4; }""", replace(in1, what1, by3)); final String what2 = "1 + 2 + 3 + '_a*"; final String by4 = "1 + 3 + $a$"; assertEquals(""" class A { int i = 1 + 3; }""", replace(in1, what2, by4)); final String by5 = "$a$ + 1 + 3"; assertEquals(""" class A { int i = 1 + 3; }""", replace(in1, what2, by5)); final String by6 = "1 + $a$ + 3"; assertEquals(""" class A { int i = 1 + 3; }""", replace(in1, what2, by6)); final String in2 = """ class A { boolean b = true && true; }"""; final String what3 = "true && true && '_a*"; final String by7 = "true && true && $a$"; assertEquals(""" class A { boolean b = true && true; }""", replace(in2, what3, by7)); final String by8 = "$a$ && true && true"; assertEquals(""" class A { boolean b = true && true; }""", replace(in2, what3, by8)); }