Skip to content

Commit 3bf602f

Browse files
committed
Updated the test case to emphasize the inconsistency with TrimSqlNode
1 parent 9b6ce3f commit 3bf602f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/test/java/org/apache/ibatis/scripting/xmltags/XMLScriptBuilderTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,14 @@ void shouldWhereInsertWhitespace() throws Exception {
3030
String xml = """
3131
<script>
3232
select * from user
33-
<where>
34-
<if test="1==1">and id = 1</if>
35-
<if test="1==1">and id > 0</if>
36-
</where>
33+
<where><if test="1==1">and id = 1</if><if test="1==1">and id > 0</if></where>
34+
<if test="1==1">and id = 1</if><if test="1==1">and id > 0</if>
3735
</script>
3836
""";
3937
SqlSource sqlSource = new XMLScriptBuilder(new Configuration(), new XPathParser(xml).evalNode("/script"))
4038
.parseScriptNode();
41-
assertThat(sqlSource.getBoundSql(1).getSql())
42-
.containsPattern("(?m)^\\s*select \\* from user\\s+WHERE\\s+id = 1\\s+and id > 0\\s*$");
39+
assertThat(sqlSource.getBoundSql(1).getSql()).containsPattern(
40+
"(?m)^\\s*select \\* from user\\s+WHERE\\s+id = 1\\s+and id > 0\\s+and id = 1\\s+and id > 0\\s*$");
4341
}
4442

4543
}

0 commit comments

Comments
 (0)