-
Notifications
You must be signed in to change notification settings - Fork 13k
format XNode toString method. #1660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
harawata
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Dreamroute ,
Thanks for the update!
There still is no test, so I wrote a simple test and it failed.
XPathParser parser = new XPathParser("<books><book><title>book1</title></book></books>");
assertEquals("<books>\n\t<book>\n\t\t<title>book1</title>\n\t</book>\n</books>",
parser.evalNode("/books").toString());Please add a test case or two so that we can understand what the expected behavior is.
p.s.
Please add new changes to this PR instead of submitting a new PR.
You can just 1) git commit new changes and then 2) git push to the same branch on your fork.
Let me know if you have any difficulty.
src/test/java/org/apache/ibatis/submitted/named_constructor_args/User.java
Outdated
Show resolved
Hide resolved
src/test/java/org/apache/ibatis/submitted/use_actual_param_name/Mapper.java
Outdated
Show resolved
Hide resolved
|
@harawata I have add a test case.pls check. |
|
Thanks for the update, @Dreamroute ! There seems to be a problem with a node with 3+ levels. @Test
public void formatXNodeToStringDeep() {
XPathParser parser = new XPathParser("<a><b><c><d>text</d></c></b></a>");
String actual = parser.evalNode("/a").toString();
String expect = "<a>\n\t<b>\n\t\t<c>\n\t\t\t<d>text</d>\n\t\t</c>\n\t</b>\n</a>\n";
assertEquals(expect, actual);
} |
|
@harawata I have solve the 3+ level format and add 3 test case. |
harawata
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the update, @Dreamroute !
Please see the comments.
|
@harawata your 2 suggest have done. |
fix: fix zhe test. test: add fomate Xnode toString() method test. fix: support 3+ level format, add 3 test case for every level. fix: fix retract. fix: revert. fix: exchange the test 'expect' and 'actual' refact: only use one StringBuilder in toString method. fix: add comments.
|
Hi @Dreamroute . |
|
HI @Dreamroute , I noticed that this patch is not good enough for actual mapper statements. <select id="getUser" resultType="org.apache.ibatis.submitted.foreach.User">
select * from users WHERE id in (
<foreach item="friendList" index="index" collection="friendList" separator=",">
#{friendList.id}
</foreach>
)
</select>Do you think you can fix it? |
Indent output of XNode#toString().
Merge pull request mybatis#1660 from Dreamroute/master
Format class XNode toString method, make the sub label retract a 'tab'. eclipse "ctrl+shift+i" to watch the value of variable friendly.