test/com/google/javascript/jscomp/parsing/ParserTest.java
/** New RegExp flags added in ES6. */
New RegExp flags added in ES6.
New RegExp flags added in ES6 .
@Test
  public void testES6RegExpFlags() {
    expectFeatures(Feature.REGEXP_FLAG_Y);
    mode = LanguageMode.ECMASCRIPT6;
    strictMode = SLOPPY;
    parse("/a/y");
    expectFeatures(Feature.REGEXP_FLAG_U);
    parse("/a/u");
    mode = LanguageMode.ECMASCRIPT5;
    expectFeatures(Feature.REGEXP_FLAG_Y);
    parseWarning("/a/y",
        getRequiresEs6Message(Feature.REGEXP_FLAG_Y));
    expectFeatures(Feature.REGEXP_FLAG_U);
    parseWarning("/a/u",
        getRequiresEs6Message(Feature.REGEXP_FLAG_U));
    parseWarning("/a/yu",
        getRequiresEs6Message(Feature.REGEXP_FLAG_Y),
        getRequiresEs6Message(Feature.REGEXP_FLAG_U));
  }
@ Test public void testES6RegExpFlags ( ) { expectFeatures ( Feature . REGEXP_FLAG_Y ) ; mode = LanguageMode . ECMASCRIPT6 ; strictMode = SLOPPY ; parse ( "/a/y" ) ; expectFeatures ( Feature . REGEXP_FLAG_U ) ; parse ( "/a/u" ) ; mode = LanguageMode . ECMASCRIPT5 ; expectFeatures ( Feature . REGEXP_FLAG_Y ) ; parseWarning ( "/a/y" , getRequiresEs6Message ( Feature . REGEXP_FLAG_Y ) ) ; expectFeatures ( Feature . REGEXP_FLAG_U ) ; parseWarning ( "/a/u" , getRequiresEs6Message ( Feature . REGEXP_FLAG_U ) ) ; parseWarning ( "/a/yu" , getRequiresEs6Message ( Feature . REGEXP_FLAG_Y ) , getRequiresEs6Message ( Feature . REGEXP_FLAG_U ) ) ; }
New RegExp flags added in ES6.
New RegExp flags added in ES6 .