[PATCH] Better implementation of JavaScript === and !== operators.

Alexander Kornienko alexfh at google.com
Thu Nov 21 03:36:48 PST 2013


  Diff of the FormatTest.cpp file:

    Index: unittests/Format/FormatTest.cpp
    ===================================================================
    --- unittests/Format/FormatTest.cpp     (revision 195336)
    +++ unittests/Format/FormatTest.cpp     (working copy)
    @@ -7326,12 +7326,19 @@
       verifyFormat("A<A<int>>();", Spaces);
     }

    +TEST_F(FormatTest, UnderstandsJavaScript) {
    +  verifyFormat("a == = b;");
    +  verifyFormat("a != = b;");

    -TEST_F(FormatTest, UnderstandsJavaScript) {
       verifyFormat("a === b;");
    -  verifyFormat("aaaaaaa === b;", getLLVMStyleWithColumns(10));
    +  verifyFormat("aaaaaaa ===\n    b;", getLLVMStyleWithColumns(10));
       verifyFormat("a !== b;");
    -  verifyFormat("aaaaaaa !== b;", getLLVMStyleWithColumns(10));
    +  verifyFormat("aaaaaaa !==\n    b;", getLLVMStyleWithColumns(10));
    +  verifyFormat("if (a + b + c +\n"
    +               "        d !==\n"
    +               "    e + f + g)\n"
    +               "  q();",
    +               getLLVMStyleWithColumns(20));
     }

     } // end namespace tooling

http://llvm-reviews.chandlerc.com/D2240



More information about the cfe-commits mailing list