Lines Matching defs:verifyFormat
48 static void verifyFormat(
56 static void verifyFormat(
67 verifyFormat("/* aaaaaaaaaaaaa */ aaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
119 verifyFormat("/** jsdoc line 1 */", getGoogleJSStyleWithColumns(20));
122 verifyFormat("/** jsdoc line 12 */", getGoogleJSStyleWithColumns(20));
184 verifyFormat("/** @returns j */", getGoogleJSStyleWithColumns(20));
230 verifyFormat("a == = b;");
231 verifyFormat("a != = b;");
233 verifyFormat("a === b;");
234 verifyFormat("aaaaaaa ===\n b;", getGoogleJSStyleWithColumns(10));
235 verifyFormat("a !== b;");
236 verifyFormat("aaaaaaa !==\n b;", getGoogleJSStyleWithColumns(10));
237 verifyFormat("if (a + b + c +\n"
243 verifyFormat("a >> >= b;");
245 verifyFormat("a >>> b;");
246 verifyFormat("aaaaaaa >>>\n b;", getGoogleJSStyleWithColumns(10));
247 verifyFormat("a >>>= b;");
248 verifyFormat("aaaaaaa >>>=\n b;", getGoogleJSStyleWithColumns(10));
249 verifyFormat("if (a + b + c +\n"
254 verifyFormat("var x = aaaaaaaaaa ?\n"
259 verifyFormat("var b = a.map((x) => x + 1);");
260 verifyFormat("return ('aaa') in bbbb;");
261 verifyFormat("var x = aaaaaaaaaaaaaaaaaaaaaaaaa() in\n"
265 verifyFormat("var x = aaaaaaaaaaaaaaaaaaaaaaaaa() in\n"
269 verifyFormat("var x = aaaaaaaaaaaaaaaaaaaaaaaaa()\n"
274 verifyFormat("someFunction(...a);");
275 verifyFormat("var x = [1, ...a, 2];");
278 verifyFormat("- -1;", " - -1;");
279 verifyFormat("-- -1;", " -- -1;");
280 verifyFormat("+ +1;", " + +1;");
281 verifyFormat("++ +1;", " ++ +1;");
285 verifyFormat("e && e.SomeFunction();");
289 verifyFormat("not.and.or.not_eq = 1;");
295 verifyFormat("x.class.struct = 1;");
296 verifyFormat("x.case = 1;");
297 verifyFormat("x.interface = 1;");
298 verifyFormat("x.for = 1;");
299 verifyFormat("x.of();");
300 verifyFormat("of(null);");
301 verifyFormat("return of(null);");
302 verifyFormat("import {of} from 'x';");
303 verifyFormat("x.in();");
304 verifyFormat("x.let();");
305 verifyFormat("x.var();");
306 verifyFormat("x.for();");
307 verifyFormat("x.as();");
308 verifyFormat("x.instanceof();");
309 verifyFormat("x.switch();");
310 verifyFormat("x.case();");
311 verifyFormat("x.delete();");
312 verifyFormat("x.throw();");
313 verifyFormat("x.throws();");
314 verifyFormat("x.if();");
315 verifyFormat("x = {\n"
320 verifyFormat("var struct = 2;");
321 verifyFormat("var union = 2;");
322 verifyFormat("var interface = 2;");
323 verifyFormat("var requires = {};");
324 verifyFormat("interface = 2;");
325 verifyFormat("x = interface instanceof y;");
326 verifyFormat("interface Test {\n"
332 verifyFormat("const Axis = {\n"
337 verifyFormat("export class Foo extends Bar {\n"
347 verifyFormat("class X {\n"
358 verifyFormat("class KeywordNamedMethods {\n"
378 verifyFormat("throw (x + y);\n"
387 verifyFormat("var [a, b, c] = [1, 2, 3];");
388 verifyFormat("const [a, b, c] = [1, 2, 3];");
389 verifyFormat("let [a, b, c] = [1, 2, 3];");
390 verifyFormat("var {a, b} = {a: 1, b: 2};");
391 verifyFormat("let {a, b} = {a: 1, b: 2};");
395 verifyFormat("var x = {\n"
400 verifyFormat("return {\n"
405 verifyFormat("return {\n"
411 verifyFormat("return {\n"
420 verifyFormat("var stuff = {\n"
428 verifyFormat("return {\n"
433 verifyFormat("var obj = {\n"
439 verifyFormat("var obj = {a: 123};");
441 verifyFormat("X = {\n a: 123\n};");
442 verifyFormat("X.Y = {\n a: 123\n};");
444 verifyFormat("function x() {\n"
447 verifyFormat("x = foo && {a: 123};");
450 verifyFormat("var x = {\n"
456 verifyFormat("var x = {y: (a) => a};");
459 verifyFormat("var x = {\n"
464 verifyFormat("var x = {\n"
471 verifyFormat("var x = {[a]: 1, b: 2, [c]: 3};");
472 verifyFormat("var x = {\n"
479 verifyFormat("f({a}, () => {\n"
485 verifyFormat("var x = {\n"
492 verifyFormat("var x = {\n"
497 verifyFormat("return {\n"
505 verifyFormat("var o = {\n"
511 verifyFormat("var o = {\n"
517 verifyFormat("var o = {\n"
523 verifyFormat("var o = {\n"
535 verifyFormat("class X {\n"
543 verifyFormat("class X {\n"
553 verifyFormat("var arr = [1, 2, 3];");
554 verifyFormat("f({a: 1, b: 2, c: 3});");
556 verifyFormat("var object_literal_with_long_name = {\n"
561 verifyFormat("f({a: 1, b: 2, c: 3});",
563 verifyFormat("f({'a': [{}]});");
567 verifyFormat("this.function('', true);");
571 verifyFormat("goog.scope(function() {\n"
575 verifyFormat("goog.scope(function() {\n"
583 verifyFormat("a = class extends goog.structs.a {\n"
588 verifyFormat("a = class Foo extends goog.structs.a {\n"
597 verifyFormat("(function() {\n"
601 verifyFormat("(function() {\n"
605 verifyFormat("(function() {\n"
609 verifyFormat("(function() {\n"
615 verifyFormat("goog.module('this.is.really.absurdly.long');",
617 verifyFormat("goog.require('this.is.really.absurdly.long');",
619 verifyFormat("goog.provide('this.is.really.absurdly.long');",
621 verifyFormat("var long = goog.require('this.is.really.absurdly.long');",
623 verifyFormat("const X = goog.requireType('this.is.really.absurdly.long');",
625 verifyFormat("goog.forwardDeclare('this.is.really.absurdly.long');",
629 verifyFormat(
632 verifyFormat("function a() {\n"
641 verifyFormat("namespace Foo {\n"
644 verifyFormat("declare namespace Foo {\n"
650 verifyFormat("declare namespace foobarbaz {\n"
653 verifyFormat("declare module foobarbaz {\n"
656 verifyFormat("namespace foobarbaz {\n"
659 verifyFormat("module foobarbaz {\n"
666 verifyFormat("declare class\n"
669 verifyFormat("declare function\n"
672 verifyFormat("declare function foo();\n"
674 verifyFormat("declare function foo(): string;\n"
676 verifyFormat("declare function foo(): {x: number};\n"
678 verifyFormat("declare class X {}\n"
680 verifyFormat("declare interface Y {}\n"
682 verifyFormat("declare enum X {\n"
685 verifyFormat("declare let\n"
691 verifyFormat("function outer1(a, b) {\n"
703 verifyFormat("function f() {}");
704 verifyFormat("function aFunction() {}\n"
708 verifyFormat("function aFunction() {}\n"
724 verifyFormat("class A {\n"
784 verifyFormat("function* f() {\n"
791 verifyFormat("function*\n"
795 verifyFormat("export function* f() {\n"
798 verifyFormat("class X {\n"
803 verifyFormat("var x = {\n"
811 verifyFormat("async function f() {\n"
815 verifyFormat("async function f() {\n"
831 verifyFormat("async function\n"
837 verifyFormat("class C {\n"
845 verifyFormat("async function* f() {\n"
848 verifyFormat("export async function f() {\n"
851 verifyFormat("let x = async () => f();");
852 verifyFormat("let x = async function() {\n"
855 verifyFormat("let x = async();");
856 verifyFormat("class X {\n"
861 verifyFormat("function initialize() {\n"
865 verifyFormat("for await (const x of y) {\n"
868 verifyFormat("function asyncLoop() {\n"
876 verifyFormat(
882 verifyFormat(
888 verifyFormat("class C extends P {\n"
896 verifyFormat("function trailingComma(\n"
906 verifyFormat("trailingComma(\n"
912 verifyFormat("trailingComma(\n"
920 verifyFormat("var aaaaa: List<SomeThing> =\n"
922 verifyFormat("return [\n"
926 verifyFormat("return [\n"
931 verifyFormat("var someVariable = SomeFunction([\n"
935 verifyFormat("var someVariable = SomeFunction([\n"
939 verifyFormat("var someVariable = SomeFunction(aaaa, [\n"
943 verifyFormat("var someVariable = SomeFunction(\n"
950 verifyFormat("var aaaa = aaaaa || // wrap\n"
953 verifyFormat("someFunction([], {a: a});");
955 verifyFormat("var string = [\n"
962 verifyFormat("var array = [\n"
966 verifyFormat("var array = someFunction([\n"
976 verifyFormat("const x = [\n"
986 verifyFormat("const x = [\n"
991 verifyFormat("const x = [\n"
996 verifyFormat("const x = {\n"
1000 verifyFormat("const x = {\n"
1005 verifyFormat("let x: {\n"
1014 verifyFormat("doFoo(function() {});");
1015 verifyFormat("doFoo(function() { return 1; });", Style);
1016 verifyFormat("var func = function() {\n"
1019 verifyFormat("var func = //\n"
1023 verifyFormat("return {\n"
1031 verifyFormat("abc = xyz ? function() {\n"
1037 verifyFormat("var closure = goog.bind(\n"
1044 verifyFormat("var closure = goog.bind(function() { // comment\n"
1048 verifyFormat("return {\n"
1056 verifyFormat("{\n"
1061 verifyFormat("someLooooooooongFunction(\n"
1068 verifyFormat("return {\n"
1074 verifyFormat("this.someObject.doSomething(aaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
1080 verifyFormat("someFunction(goog.bind(function() {\n"
1088 verifyFormat("SomeFunction(function() {\n"
1093 verifyFormat("SomeFunction((function() {\n"
1099 verifyFormat("someFunction(function() {\n"
1107 verifyFormat("f({a: function() { return 1; }});", Style);
1109 verifyFormat("f({\n"
1116 verifyFormat("(aaaaaaaaaaaaaaaaaaaaa.getData as jasmine.Spy)\n"
1118 verifyFormat("(aaaaaaaaaaaaaaaaaaaaa.getData as jasmine.Spy)\n"
1120 verifyFormat("(aaaaaaaaaaaaaaaaaaaaa.getData as jasmine.Spy)\n"
1127 verifyFormat("var func = function() {\n"
1131 verifyFormat("var func = doSomething(function() { return 1; });", Style);
1132 verifyFormat("var outer = function() {\n"
1136 verifyFormat("function outer1(a, b) {\n"
1142 verifyFormat("var func = function() { return 1; };", Style);
1143 verifyFormat("var func = doSomething(function() { return 1; });", Style);
1144 verifyFormat(
1147 verifyFormat("function outer1(a, b) {\n"
1153 verifyFormat("var func = function() {\n"
1157 verifyFormat("var func = doSomething(function() {\n"
1161 verifyFormat("var outer = function() {\n"
1167 verifyFormat("function outer1(a, b) {\n"
1175 verifyFormat("var func = function() {\n"
1184 verifyFormat("promise.then(\n"
1194 verifyFormat("promise.then(\n"
1204 verifyFormat("promise.then(\n"
1215 verifyFormat("getSomeLongPromise()\n"
1222 verifyFormat("getSomeLongPromise()\n"
1232 verifyFormat("getSomeLongPromise()\n"
1237 verifyFormat("return [aaaaaaaaaaaaaaaaaaaaaa]\n"
1245 verifyFormat("var x = (a) => {\n"
1249 verifyFormat("var x = (a) => {\n"
1255 verifyFormat("var x = (a: type): {some: type} => {\n"
1259 verifyFormat("var x = (a) => a;");
1260 verifyFormat("return () => [];");
1261 verifyFormat("var aaaaaaaaaaaaaaaaaaaa = {\n"
1267 verifyFormat("var a = a.aaaaaaa(\n"
1270 verifyFormat("var a = a.aaaaaaa(\n"
1276 verifyFormat("someFunction(() => {\n"
1282 verifyFormat("const f = (x: string|null): string|null => {\n"
1291 verifyFormat("const arr = () => { x; };", Style);
1292 verifyFormat("const arrInlineAll = () => {};", Style);
1294 verifyFormat("const arr = () => {\n"
1298 verifyFormat("const arrInlineNone = () => {\n"
1302 verifyFormat("const arr = () => {\n"
1306 verifyFormat("const arrInlineEmpty = () => {};", Style);
1308 verifyFormat("const arr = () => {\n"
1312 verifyFormat("foo(() => {});", Style);
1313 verifyFormat("const arrInlineInline = () => {};", Style);
1317 verifyFormat("function() {\n"
1323 verifyFormat("for (var i in [2, 3]) {\n"
1325 verifyFormat("for (var i of [2, 3]) {\n"
1327 verifyFormat("for (let {a, b} of x) {\n"
1329 verifyFormat("for (let {a, b} of [x]) {\n"
1331 verifyFormat("for (let [a, b] of [x]) {\n"
1333 verifyFormat("for (let {a, b} in x) {\n"
1341 verifyFormat("return aaaaa;", getGoogleJSStyleWithColumns(10));
1342 verifyFormat("yield aaaaa;", getGoogleJSStyleWithColumns(10));
1343 verifyFormat("return /* hello! */ aaaaa;", getGoogleJSStyleWithColumns(10));
1344 verifyFormat("continue aaaaa;", getGoogleJSStyleWithColumns(10));
1345 verifyFormat("continue /* hello! */ aaaaa;", getGoogleJSStyleWithColumns(10));
1346 verifyFormat("break aaaaa;", getGoogleJSStyleWithColumns(10));
1347 verifyFormat("throw aaaaa;", getGoogleJSStyleWithColumns(10));
1348 verifyFormat("aaaaaaaaa++;", getGoogleJSStyleWithColumns(10));
1349 verifyFormat("aaaaaaaaa--;", getGoogleJSStyleWithColumns(10));
1350 verifyFormat("return [\n"
1354 verifyFormat("class X {\n"
1362 verifyFormat("const x = (5 + 9)\n"
1367 verifyFormat("async function\n"
1370 verifyFormat("await theReckoning;", getGoogleJSStyleWithColumns(10));
1371 verifyFormat("some['a']['b']", getGoogleJSStyleWithColumns(10));
1372 verifyFormat("x = (a['a']\n"
1375 verifyFormat("function f() {\n"
1387 verifyFormat("Polymer({\n"
1395 verifyFormat("a\n"
1399 verifyFormat("a()\n"
1403 verifyFormat("a[b]\n"
1407 verifyFormat("1\n"
1411 verifyFormat("a\n"
1415 verifyFormat("a\n"
1419 verifyFormat("a++\n"
1423 verifyFormat("a\n"
1427 verifyFormat("a\n"
1431 verifyFormat("a\n"
1435 verifyFormat("var a", "var\n"
1437 verifyFormat("x instanceof String", "x\n"
1440 verifyFormat("function f(@Foo bar) {}", "function f(@Foo\n"
1442 verifyFormat("function f(@Foo(Param) bar) {}", "function f(@Foo(Param)\n"
1444 verifyFormat("a = true\n"
1448 verifyFormat("a = 's'\n"
1452 verifyFormat("a = null\n"
1457 verifyFormat("x = {\n"
1462 verifyFormat("if (x) {\n"
1467 verifyFormat("if (x) {\n"
1475 verifyFormat("import {x} from 'y'\n"
1480 verifyFormat("export {x} class Y {}", " export {x}\n"
1482 verifyFormat("if (x) {\n"
1490 verifyFormat("import type {x, y} from 'y';\n"
1494 verifyFormat("export type {x, y} from 'y';\n"
1501 verifyFormat("var x = /** @type {foo} */ (bar);");
1505 verifyFormat("try {\n"
1514 verifyFormat("someObject.catch();");
1515 verifyFormat("someObject.new();");
1519 verifyFormat("var literal = 'hello ' +\n"
1523 verifyFormat("var literal =\n"
1531 verifyFormat("var regex = /abc/;");
1532 verifyFormat("f(/abc/);");
1533 verifyFormat("f(abc, /abc/);");
1534 verifyFormat("some_map[/abc/];");
1535 verifyFormat("var x = a ? /abc/ : /abc/;");
1536 verifyFormat("for (var i = 0; /abc/.test(s[i]); i++) {\n}");
1537 verifyFormat("var x = !/abc/.test(y);");
1538 verifyFormat("var x = foo()! / 10;");
1539 verifyFormat("var x = a && /abc/.test(y);");
1540 verifyFormat("var x = a || /abc/.test(y);");
1541 verifyFormat("var x = a + /abc/.search(y);");
1542 verifyFormat("/abc/.search(y);");
1543 verifyFormat("var regexs = {/abc/, /abc/};");
1544 verifyFormat("return /abc/;");
1547 verifyFormat("var a = a / 2 + b / 3;");
1548 verifyFormat("var a = a++ / 2;");
1550 verifyFormat("var a = ++/a/;");
1554 verifyFormat("if (foo) / bar /.exec(baz);");
1558 verifyFormat("var regex = /=/;");
1559 verifyFormat("var regex = /a*/;");
1560 verifyFormat("var regex = /a+/;");
1561 verifyFormat("var regex = /a?/;");
1562 verifyFormat("var regex = /.a./;");
1563 verifyFormat("var regex = /a\\*/;");
1564 verifyFormat("var regex = /^a$/;");
1565 verifyFormat("var regex = /\\/a/;");
1566 verifyFormat("var regex = /(?:x)/;");
1567 verifyFormat("var regex = /x(?=y)/;");
1568 verifyFormat("var regex = /x(?!y)/;");
1569 verifyFormat("var regex = /x|y/;");
1570 verifyFormat("var regex = /a{2}/;");
1571 verifyFormat("var regex = /a{1,3}/;");
1573 verifyFormat("var regex = /[abc]/;");
1574 verifyFormat("var regex = /[^abc]/;");
1575 verifyFormat("var regex = /[\\b]/;");
1576 verifyFormat("var regex = /[/]/;");
1577 verifyFormat("var regex = /[\\/]/;");
1578 verifyFormat("var regex = /\\[/;");
1579 verifyFormat("var regex = /\\\\[/]/;");
1580 verifyFormat("var regex = /}[\"]/;");
1581 verifyFormat("var regex = /}[/\"]/;");
1582 verifyFormat("var regex = /}[\"/]/;");
1584 verifyFormat("var regex = /\\b/;");
1585 verifyFormat("var regex = /\\B/;");
1586 verifyFormat("var regex = /\\d/;");
1587 verifyFormat("var regex = /\\D/;");
1588 verifyFormat("var regex = /\\f/;");
1589 verifyFormat("var regex = /\\n/;");
1590 verifyFormat("var regex = /\\r/;");
1591 verifyFormat("var regex = /\\s/;");
1592 verifyFormat("var regex = /\\S/;");
1593 verifyFormat("var regex = /\\t/;");
1594 verifyFormat("var regex = /\\v/;");
1595 verifyFormat("var regex = /\\w/;");
1596 verifyFormat("var regex = /\\W/;");
1597 verifyFormat("var regex = /a(a)\\1/;");
1598 verifyFormat("var regex = /\\0/;");
1599 verifyFormat("var regex = /\\\\/g;");
1600 verifyFormat("var regex = /\\a\\\\/g;");
1601 verifyFormat("var regex = /\a\\//g;");
1602 verifyFormat("var regex = /a\\//;\n"
1604 verifyFormat("var regex = /'/g;", "var regex = /'/g ;");
1605 verifyFormat("var regex = /'/g; //'", "var regex = /'/g ; //'");
1606 verifyFormat("var regex = /\\/*/;\n"
1610 verifyFormat("var x = /a\\//;", "var x = /a\\// \n;");
1611 verifyFormat("var regex = /\"/;", getGoogleJSStyleWithColumns(16));
1612 verifyFormat("var regex =\n"
1615 verifyFormat("var regex = //\n"
1617 verifyFormat("var regexs = [\n"
1624 verifyFormat("var regex = /abc/g;");
1625 verifyFormat("var regex = /abc/i;");
1626 verifyFormat("var regex = /abc/m;");
1627 verifyFormat("var regex = /abc/y;");
1631 verifyFormat("var regex = /aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/;",
1633 verifyFormat("var regex =\n"
1636 verifyFormat("var regex = /\\xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/;",
1641 verifyFormat("var regex = search.match(/(?:\?|&)times=([^?&]+)/i);");
1650 verifyFormat(MpegTS, MpegTS);
1654 verifyFormat("var x: string;");
1655 verifyFormat("var x: {a: string; b: number;} = {};");
1656 verifyFormat("function x(): string {\n return 'x';\n}");
1657 verifyFormat("function x(): {x: string} {\n return {x: 'x'};\n}");
1658 verifyFormat("function x(y: string): string {\n return 'x';\n}");
1659 verifyFormat("for (var y: string in x) {\n x();\n}");
1660 verifyFormat("for (var y: string of x) {\n x();\n}");
1661 verifyFormat("function x(y: {a?: number;} = {}): number {\n"
1664 verifyFormat("const x: Array<{a: number; b: string;}> = [];");
1665 verifyFormat("((a: string, b: number): string => a + b);");
1666 verifyFormat("var x: (y: number) => string;");
1667 verifyFormat("var x: P<string, (a: number) => string>;");
1668 verifyFormat("var x = {\n"
1673 verifyFormat("var x = {\n"
1678 verifyFormat("function someFunc(args: string[]):\n"
1681 verifyFormat(
1684 verifyFormat("const xIsALongIdent:\n"
1687 verifyFormat("const x = {\n"
1693 verifyFormat("let x: A|B = A | B;");
1694 verifyFormat("let x: A&B|C = A & B;");
1695 verifyFormat("let x: Foo<A|B> = new Foo<A|B>();");
1696 verifyFormat("function(x: A|B): C&D {}");
1697 verifyFormat("function(x: A|B = A | B): C&D {}");
1698 verifyFormat("function x(path: number|string) {}");
1699 verifyFormat("function x(): string|number {}");
1700 verifyFormat("type Foo = Bar|Baz;");
1701 verifyFormat("type Foo = Bar<X>|Baz;");
1702 verifyFormat("type Foo = (Bar<X>|Baz);");
1703 verifyFormat("let x: Bar|Baz;");
1704 verifyFormat("let x: Bar<X>|Baz;");
1705 verifyFormat("let x: (Foo|Bar)[];");
1706 verifyFormat("type X = {\n"
1709 verifyFormat("export type X = {\n"
1715 verifyFormat("let x: {x: number|null} = {x: number | null};");
1716 verifyFormat("let nested: {x: {y: number|null}};");
1717 verifyFormat("let mixed: {x: [number|null, {w: number}]};");
1718 verifyFormat("class X {\n"
1727 verifyFormat("class C {\n x: string = 12;\n}");
1728 verifyFormat("class C {\n x(): string => 12;\n}");
1729 verifyFormat("class C {\n ['x' + 2]: string = 12;\n}");
1730 verifyFormat("class C {\n"
1734 verifyFormat("class C {\n private x: string = 12;\n}");
1735 verifyFormat("class C {\n private static x: string = 12;\n}");
1736 verifyFormat("class C {\n static x(): string {\n return 'asd';\n }\n}");
1737 verifyFormat("class C extends P implements I {}");
1738 verifyFormat("class C extends p.P implements i.I {}");
1739 verifyFormat("x(class {\n"
1742 verifyFormat("class Test {\n"
1746 verifyFormat("foo = class Name {\n"
1749 verifyFormat("foo = class {\n"
1752 verifyFormat("class C {\n"
1756 verifyFormat("class Foo {\n"
1762 verifyFormat("class X {\n"
1769 verifyFormat("@Component({\n"
1778 verifyFormat("class X {\n"
1786 verifyFormat("interface I {\n"
1793 verifyFormat("interface a {}\n"
1798 verifyFormat("interface I {\n"
1804 verifyFormat("class C extends {} {}");
1805 verifyFormat("class C implements {bar: number} {}");
1807 verifyFormat("class C implements {\n"
1811 verifyFormat("class C<P extends {}> {}");
1815 verifyFormat("enum Foo {\n"
1819 verifyFormat("export /* somecomment*/ enum Foo {\n"
1823 verifyFormat("enum Foo {\n"
1828 verifyFormat("const enum Foo {\n"
1832 verifyFormat("export const enum Foo {\n"
1839 verifyFormat("@A\nclass C {\n}");
1840 verifyFormat("@A({arg: 'value'})\nclass C {\n}");
1841 verifyFormat("@A\n@B\nclass C {\n}");
1842 verifyFormat("class C {\n @A x: string;\n}");
1843 verifyFormat("class C {\n"
1849 verifyFormat("class C {\n"
1852 verifyFormat("class X {}\n"
1854 verifyFormat("class X {\n"
1860 verifyFormat("type X = number;\n"
1862 verifyFormat("type X<Y> = Z<Y>;");
1863 verifyFormat("type X = {\n"
1867 verifyFormat("export type X = {\n"
1875 verifyFormat("type LongTypeIsReallyUnreasonablyLong =\n"
1878 verifyFormat("interface AbstractStrategyFactoryProvider {\n"
1886 verifyFormat("x = () => {\n"
1899 verifyFormat("import SomeThing from 'some/module.js';");
1900 verifyFormat("import {X, Y} from 'some/module.js';");
1901 verifyFormat("import a, {X, Y} from 'some/module.js';");
1902 verifyFormat("import {X, Y,} from 'some/module.js';");
1903 verifyFormat("import {X as myLocalX, Y as myLocalY} from 'some/module.js';");
1905 verifyFormat("import {X as myX} from 'm';", "import {X as\n"
1907 verifyFormat("import * as lib from 'some/module.js';");
1908 verifyFormat("var x = {import: 1};\nx.import = 2;");
1910 verifyFormat("function() {\n"
1915 verifyFormat("export function fn() {\n"
1918 verifyFormat("export function A() {}\n"
1921 verifyFormat("export default () => {\n"
1925 verifyFormat("export const x = 12;");
1926 verifyFormat("export default class X {}");
1927 verifyFormat("export {X, Y} from 'some/module.js';");
1928 verifyFormat("export {X, Y,} from 'some/module.js';");
1929 verifyFormat("export {SomeVeryLongExport as X, "
1932 verifyFormat("export let someRatherLongVariableName =\n"
1935 verifyFormat("export {\n"
1941 verifyFormat("export class C {\n"
1945 verifyFormat("export class X {\n"
1948 verifyFormat("export abstract class X {\n"
1951 verifyFormat("export default class X {\n"
1954 verifyFormat("export default function() {\n return 1;\n}");
1955 verifyFormat("export var x = 12;");
1956 verifyFormat("class C {}\n"
1959 verifyFormat("export var x: number = 12;");
1960 verifyFormat("export const y = {\n"
1964 verifyFormat("export enum Foo {\n"
1969 verifyFormat("export default [\n"
1973 verifyFormat("export default [];");
1974 verifyFormat("export default () => {};");
1975 verifyFormat("export default () => {\n"
1979 verifyFormat("export interface Foo {\n"
1990 verifyFormat("import {VeryLongImportsAreAnnoying, VeryLongImportsAreAnnoying,"
1995 verifyFormat("import {\n"
2001 verifyFormat("import {\n"
2006 verifyFormat("export {\n"
2012 // Using this version of verifyFormat because test::messUp hides the issue.
2013 verifyFormat("import {\n"
2026 verifyFormat("var x = `hello\n"
2033 verifyFormat("var x =\n"
2036 verifyFormat("var x = `hello ${world}` >= some();",
2038 verifyFormat("var x = `hellö ${wörld}` >= söme();",
2040 verifyFormat("var x = `hello\n"
2047 verifyFormat("var x = `hello\n"
2054 verifyFormat("var x =\n"
2057 verifyFormat("var x =\n `multi\n line`;", "var x = `multi\n line`;",
2059 verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
2062 verifyFormat(
2071 verifyFormat("var a = aaaaaaaaaaaaaaaaaaaaaaaaaaaa ||\n"
2075 verifyFormat("var x = `hello` == `hello`;");
2078 verifyFormat("var x = `//a`;\n"
2082 verifyFormat("var x = `/*a`;\n"
2087 verifyFormat("var x = `'`; // comment with matching quote '\n"
2089 verifyFormat("var x = `\"`; // comment with matching quote \"\n"
2091 verifyFormat("it(`'aaaaaaaaaaaaaaa `, aaaaaaaaa);",
2095 verifyFormat("var x = 1 // `/*a`;\n"
2099 verifyFormat("/* ` */ var x = 1; /* ` */", "/* ` */ var x\n= 1; /* ` */");
2101 verifyFormat("var x = `/*a`;\n"
2106 verifyFormat("var x = ` \\` a`;\n"
2111 verifyFormat("var x = ` \\${foo}`;");
2115 verifyFormat("var f = `aaaa ${a ? 'a' : 'b'}`;");
2119 verifyFormat("var f = `aaaaaaaaaaaaa:${aaaaaaa.aaaaa} aaaaaaaa\n"
2123 verifyFormat("var x = someFunction(`${})`) //\n"
2125 verifyFormat("var x = someFunction(`${aaaa}${\n"
2131 verifyFormat("var f = `aaaaaaaaaaaaaaaaaa: ${\n"
2136 verifyFormat("var f = `\n"
2143 verifyFormat("var f = `\n"
2154 verifyFormat("var f = `\n"
2165 verifyFormat("`${\n"
2174 verifyFormat("var x = `hello${world}`;", "var x = `hello${\n"
2180 verifyFormat(
2182 verifyFormat("var x = `he${({text: 'll'}.text)}o`;");
2185 verifyFormat("}");
2186 verifyFormat("`");
2188 // verifyFormat("`\\");
2192 verifyFormat("var x = html`<ul>`;");
2193 verifyFormat("yield `hello`;");
2194 verifyFormat("var f = {\n"
2203 verifyFormat("var x = <type>foo;");
2204 verifyFormat("var x = foo as type;");
2205 verifyFormat("let x = (a + b) as\n"
2208 verifyFormat("foo = <Bar[]>[\n"
2212 verifyFormat("var x = [{x: 1} as type];");
2213 verifyFormat("x = x as [a, b];");
2214 verifyFormat("x = x as {a: string};");
2215 verifyFormat("x = x as (string);");
2216 verifyFormat("x = x! as (string);");
2217 verifyFormat("x = y! in z;");
2218 verifyFormat("var x = something.someFunction() as\n"
2224 verifyFormat("class X<Y> {}");
2225 verifyFormat("new X<Y>();");
2226 verifyFormat("foo<Y>(a);");
2227 verifyFormat("var x: X<Y>[];");
2228 verifyFormat("class C extends D<E> implements F<G>, H<I> {}");
2229 verifyFormat("function f(a: List<any> = null) {}");
2230 verifyFormat("function f(): List<any> {}");
2231 verifyFormat("function aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa():\n"
2233 verifyFormat("function aaaaaaaaaa(\n"
2240 verifyFormat(
2248 verifyFormat("function x(a?: b, c?, d?) {}");
2249 verifyFormat("class X {\n"
2253 verifyFormat("interface X {\n"
2256 verifyFormat("constructor({aa}: {\n"
2262 verifyFormat("type X = [y?];");
2266 verifyFormat("var x: {[k: string]: v};");
2270 verifyFormat("xxxxxxxxxxx(\n"
2273 verifyFormat("xxxxxxxxxxx(\n"
2277 verifyFormat("xxxxxxxxxxx(\n"
2283 verifyFormat("while (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &&\n"
2288 verifyFormat("/**\n"
2295 verifyFormat("/**\n"
2302 verifyFormat("/**\n"
2309 verifyFormat("/**\n"
2318 verifyFormat("/**\n"
2327 verifyFormat("/**\n"
2336 verifyFormat("/**\n"
2345 verifyFormat("/**\n"
2352 verifyFormat("/**\n"
2387 verifyFormat("// Comment that needs wrapping. Comment that needs wrapping. "
2399 verifyFormat("// Comment that needs wrapping. Comment that needs wrapping. "
2407 verifyFormat("// Comment that needs wrapping. Comment that needs wrapping. "
2418 verifyFormat("var x = 'foo';", "var x = \"foo\";");
2419 verifyFormat("var x = 'fo\\'o\\'';", "var x = \"fo'o'\";");
2420 verifyFormat("var x = 'fo\\'o\\'';", "var x = \"fo\\'o'\";");
2421 verifyFormat("var x =\n"
2427 verifyFormat("var x = 'fo\"o';", "var x = \"fo\\\"o\";");
2429 verifyFormat("var x = 'fo\"o';", "var x = \"fo\\\"o\";",
2431 verifyFormat("// clang-format off\n"
2442 verifyFormat("let x = someVeryLongFunctionThatGoesOnAndOn(\n"
2447 verifyFormat("let x =\n"
2459 verifyFormat("var x = \"foo\";", DoubleQuotes);
2460 verifyFormat("var x = \"foo\";", "var x = 'foo';", DoubleQuotes);
2461 verifyFormat("var x = \"fo'o\";", "var x = 'fo\\'o';", DoubleQuotes);
2467 verifyFormat("var x = \"foo\";", LeaveQuotes);
2468 verifyFormat("var x = 'foo';", LeaveQuotes);
2472 verifyFormat("#!/usr/bin/env node\n"
2479 verifyFormat("let x = foo!.bar();");
2480 verifyFormat("let x = foo ? bar! : baz;");
2481 verifyFormat("let x = !foo;");
2482 verifyFormat("if (!+a) {\n}");
2483 verifyFormat("let x = foo[0]!;");
2484 verifyFormat("let x = (foo)!;");
2485 verifyFormat("let x = x(foo!);");
2486 verifyFormat("a.aaaaaa(a.a!).then(\n"
2489 verifyFormat("let x = foo! - 1;");
2490 verifyFormat("let x = {foo: 1}!;");
2491 verifyFormat("let x = hello.foo()!\n"
2496 verifyFormat("let x = namespace!;");
2497 verifyFormat("return !!x;");
2502 verifyFormat("return operator && (aa);");
2504 verifyFormat("const slots: Slot[];");
2507 verifyFormat("auto!;");
2508 verifyFormat("char!;");
2509 verifyFormat("concept!;");
2510 verifyFormat("double!;");
2511 verifyFormat("extern!;");
2512 verifyFormat("float!;");
2513 verifyFormat("inline!;");
2514 verifyFormat("int!;");
2515 verifyFormat("long!;");
2516 verifyFormat("register!;");
2517 verifyFormat("restrict!;");
2518 verifyFormat("sizeof!;");
2519 verifyFormat("struct!;");
2520 verifyFormat("typedef!;");
2521 verifyFormat("union!;");
2522 verifyFormat("unsigned!;");
2523 verifyFormat("volatile!;");
2524 verifyFormat("_Alignas!;");
2525 verifyFormat("_Alignof!;");
2526 verifyFormat("_Atomic!;");
2527 verifyFormat("_Bool!;");
2528 verifyFormat("_Complex!;");
2529 verifyFormat("_Generic!;");
2530 verifyFormat("_Imaginary!;");
2531 verifyFormat("_Noreturn!;");
2532 verifyFormat("_Static_assert!;");
2533 verifyFormat("_Thread_local!;");
2534 verifyFormat("__func__!;");
2535 verifyFormat("__objc_yes!;");
2536 verifyFormat("__objc_no!;");
2537 verifyFormat("asm!;");
2538 verifyFormat("bool!;");
2539 verifyFormat("const_cast!;");
2540 verifyFormat("dynamic_cast!;");
2541 verifyFormat("explicit!;");
2542 verifyFormat("friend!;");
2543 verifyFormat("mutable!;");
2544 verifyFormat("operator!;");
2545 verifyFormat("reinterpret_cast!;");
2546 verifyFormat("static_cast!;");
2547 verifyFormat("template!;");
2548 verifyFormat("typename!;");
2549 verifyFormat("typeid!;");
2550 verifyFormat("using!;");
2551 verifyFormat("virtual!;");
2552 verifyFormat("wchar_t!;");
2555 verifyFormat("x.type!;");
2556 verifyFormat("x.get!;");
2557 verifyFormat("x.set!;");
2561 verifyFormat("let x = foo?.bar?.baz();");
2562 verifyFormat("let x = foo?.(foo);");
2563 verifyFormat("let x = foo?.['arr'];");
2567 verifyFormat("const val = something ?? 'some other default';");
2568 verifyFormat("const val = something ?? otherDefault ??\n"
2575 verifyFormat("a &&= b;");
2576 verifyFormat("a ||= b;");
2579 verifyFormat("a ?"
2584 verifyFormat("y = x ? 1 : 2;");
2585 verifyFormat("x ? 1 : 2;");
2586 verifyFormat("class Foo {\n"
2593 verifyFormat("import {x} from 'x'; // from some location",
2595 verifyFormat("// taze: x from 'location'", getGoogleJSStyleWithColumns(10));
2596 verifyFormat("/// <reference path=\"some/location\" />",
2601 verifyFormat("squared = x ** 2;");
2602 verifyFormat("squared **= 2;");
2608 verifyFormat("var l = [\n"
2614 verifyFormat("var l = [\n"
2620 verifyFormat("someFunction(\n"
2627 verifyFormat("someFunction(\n"
2634 verifyFormat("var o = {\n"
2641 verifyFormat("var o = {\n"
2651 verifyFormat("// hello \\\n"
2656 verifyFormat("/* ignore \\\n"
2662 verifyFormat("// st \\ art\\\n"
2693 verifyFormat("callFoo(/*spaceAfterParameterNamingComment=*/ 1);");
2699 verifyFormat( // wrap
2706 verifyFormat("class Example {\n"
2728 verifyFormat("class Example {\n"
2735 verifyFormat(
2750 verifyFormat("x = 1_000_000 + 12;", "x = 1_000_000 + 12;");
2756 verifyFormat("let letVariable = 5;\n"
2760 verifyFormat("let letVariable = 5;\n"
2764 verifyFormat("let letVariable = 5;\n"
2768 verifyFormat("let letVariable = 5;\n"
2772 verifyFormat("let letVariable = 5;\n"
2776 verifyFormat("double letVariable = 5;\n"
2780 verifyFormat("const letVariable = 5;\n"
2784 verifyFormat("int letVariable = 5;\n"
2793 verifyFormat("let letVariable = 5;\n"
2797 verifyFormat("let letVariable = 5;\n"
2801 verifyFormat("let letVariable = 5;\n"
2805 verifyFormat("let letVariable = 5;\n"
2809 verifyFormat("let letVariable = 5;\n"
2813 verifyFormat("double letVariable = 5;\n"
2817 verifyFormat("const letVariable = 5;\n"
2821 verifyFormat("int letVariable = 5;\n"
2830 verifyFormat("let letVariable = 5;\n"
2834 verifyFormat("let letVariable = 5;\n"
2838 verifyFormat("let letVariable = 5;\n"
2842 verifyFormat("let letVariable = 5;\n"
2846 verifyFormat("let letVariable = 5;\n"
2850 verifyFormat("double letVariable = 5;\n"
2854 verifyFormat("const letVariable = 5;\n"
2858 verifyFormat("int letVariable = 5;\n"
2864 verifyFormat("export type Params = Config&{\n"
2872 verifyFormat("ctrl.onCopy(/** @type {!WizEvent}*/ (\n"
2875 verifyFormat("failedUserIds.push(...subscriptioxxxxxxxxxxxxnSubset.map(\n"
2878 verifyFormat("failedUserIds.push(!subscriptioxxxxxxxxxxxxnSubset.map(\n"
2881 verifyFormat("failedUserIds.push(await subscriptioxxxxxxxxxxxxnSubset.map(\n"
2884 verifyFormat("for await (const packageId of ops.api.iterateEmbeddedFiles(\n"