<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Nov 20, 2013 at 8:32 AM, Alexander Kornienko <span dir="ltr"><<a href="mailto:alexfh@google.com" target="_blank" class="cremed">alexfh@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div class="im">On Wed, Nov 20, 2013 at 4:03 PM, Daniel Jasper <span dir="ltr"><<a href="mailto:djasper@google.com" target="_blank" class="cremed">djasper@google.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

+<br>
+TEST_F(FormatTest, UnderstandsJavaScript) {<br>
+  verifyFormat("a === b;");<br>
+  verifyFormat("aaaaaaa === b;", getLLVMStyleWithColumns(10));<br></blockquote><div><br></div></div></div><div>How is this the correct format? Wouldn't we expect a break before "b"?</div></div></div>

</div></blockquote><div><br></div></div><div>This need some work still, this patch just stops clang-format from breaking the code by inserting a space inside these operators. I'll add a FIXME to the test and a commented out test with the correct formatting.</div>
</div></div></div></blockquote><div><br></div><div>ok.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div class="im">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



+  verifyFormat("a !== b;");<br>
+  verifyFormat("aaaaaaa !== b;", getLLVMStyleWithColumns(10));<br>
+}<br>
+<br></blockquote><div><br></div></div><div>Also, I think these tests are not sufficient. What if the LHS of one of these operators needs to be broken over multiple lines (there is a whole lot of logic of what happens to the RHS then)?</div>

</div></div></div></blockquote><div><br></div></div><div>I'll add more complex tests (probably, commented-out, as we don't get this quite right yet).</div><div class="im"><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I think we actually might need to merge the tokens.</div></div></div></div></blockquote><div><br></div></div><div>I was thinking about this. What if we just "hide" the "=", so that clang-format thinks there's just == or !=? I don't think we need to have any logic specific to javascript identity operators.</div>
</div></div></div></blockquote><div><br></div><div>Yes. We'll also need to increase the length of the token, but other than that this is what I mean by "merging".</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div>  </div></div>
</div></div>
</blockquote></div><br></div></div>