| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.ast_test; | 8 library engine.ast_test; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
| (...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1588 JUnitTestCase.assertEquals(2, new SimpleStringLiteral(TokenFactory.tokenFrom
String("'X'"), "X").contentsEnd); | 1588 JUnitTestCase.assertEquals(2, new SimpleStringLiteral(TokenFactory.tokenFrom
String("'X'"), "X").contentsEnd); |
| 1589 JUnitTestCase.assertEquals(2, new SimpleStringLiteral(TokenFactory.tokenFrom
String("\"X\""), "X").contentsEnd); | 1589 JUnitTestCase.assertEquals(2, new SimpleStringLiteral(TokenFactory.tokenFrom
String("\"X\""), "X").contentsEnd); |
| 1590 JUnitTestCase.assertEquals(4, new SimpleStringLiteral(TokenFactory.tokenFrom
String("\"\"\"X\"\"\""), "X").contentsEnd); | 1590 JUnitTestCase.assertEquals(4, new SimpleStringLiteral(TokenFactory.tokenFrom
String("\"\"\"X\"\"\""), "X").contentsEnd); |
| 1591 JUnitTestCase.assertEquals(4, new SimpleStringLiteral(TokenFactory.tokenFrom
String("'''X'''"), "X").contentsEnd); | 1591 JUnitTestCase.assertEquals(4, new SimpleStringLiteral(TokenFactory.tokenFrom
String("'''X'''"), "X").contentsEnd); |
| 1592 JUnitTestCase.assertEquals(3, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r'X'"), "X").contentsEnd); | 1592 JUnitTestCase.assertEquals(3, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r'X'"), "X").contentsEnd); |
| 1593 JUnitTestCase.assertEquals(3, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r\"X\""), "X").contentsEnd); | 1593 JUnitTestCase.assertEquals(3, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r\"X\""), "X").contentsEnd); |
| 1594 JUnitTestCase.assertEquals(5, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r\"\"\"X\"\"\""), "X").contentsEnd); | 1594 JUnitTestCase.assertEquals(5, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r\"\"\"X\"\"\""), "X").contentsEnd); |
| 1595 JUnitTestCase.assertEquals(5, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r'''X'''"), "X").contentsEnd); | 1595 JUnitTestCase.assertEquals(5, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r'''X'''"), "X").contentsEnd); |
| 1596 } | 1596 } |
| 1597 | 1597 |
| 1598 void test_isSingleQuoted() { |
| 1599 // ' |
| 1600 { |
| 1601 var token = TokenFactory.tokenFromString("'X'"); |
| 1602 var node = new SimpleStringLiteral(token, null); |
| 1603 JUnitTestCase.assertTrue(node.isSingleQuoted); |
| 1604 } |
| 1605 // ''' |
| 1606 { |
| 1607 var token = TokenFactory.tokenFromString("'''X'''"); |
| 1608 var node = new SimpleStringLiteral(token, null); |
| 1609 JUnitTestCase.assertTrue(node.isSingleQuoted); |
| 1610 } |
| 1611 // " |
| 1612 { |
| 1613 var token = TokenFactory.tokenFromString('"X"'); |
| 1614 var node = new SimpleStringLiteral(token, null); |
| 1615 JUnitTestCase.assertFalse(node.isSingleQuoted); |
| 1616 } |
| 1617 // """ |
| 1618 { |
| 1619 var token = TokenFactory.tokenFromString('"""X"""'); |
| 1620 var node = new SimpleStringLiteral(token, null); |
| 1621 JUnitTestCase.assertFalse(node.isSingleQuoted); |
| 1622 } |
| 1623 } |
| 1624 |
| 1625 void test_isSingleQuoted_raw() { |
| 1626 // r' |
| 1627 { |
| 1628 var token = TokenFactory.tokenFromString("r'X'"); |
| 1629 var node = new SimpleStringLiteral(token, null); |
| 1630 JUnitTestCase.assertTrue(node.isSingleQuoted); |
| 1631 } |
| 1632 // r''' |
| 1633 { |
| 1634 var token = TokenFactory.tokenFromString("r'''X'''"); |
| 1635 var node = new SimpleStringLiteral(token, null); |
| 1636 JUnitTestCase.assertTrue(node.isSingleQuoted); |
| 1637 } |
| 1638 // r" |
| 1639 { |
| 1640 var token = TokenFactory.tokenFromString('r"X"'); |
| 1641 var node = new SimpleStringLiteral(token, null); |
| 1642 JUnitTestCase.assertFalse(node.isSingleQuoted); |
| 1643 } |
| 1644 // r""" |
| 1645 { |
| 1646 var token = TokenFactory.tokenFromString('r"""X"""'); |
| 1647 var node = new SimpleStringLiteral(token, null); |
| 1648 JUnitTestCase.assertFalse(node.isSingleQuoted); |
| 1649 } |
| 1650 } |
| 1651 |
| 1598 void test_isMultiline() { | 1652 void test_isMultiline() { |
| 1599 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("'X'"), "X").isMultiline); | 1653 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("'X'"), "X").isMultiline); |
| 1600 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("r'X'"), "X").isMultiline); | 1654 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("r'X'"), "X").isMultiline); |
| 1601 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("\"X\""), "X").isMultiline); | 1655 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("\"X\""), "X").isMultiline); |
| 1602 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("r\"X\""), "X").isMultiline); | 1656 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("r\"X\""), "X").isMultiline); |
| 1603 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin
g("'''X'''"), "X").isMultiline); | 1657 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin
g("'''X'''"), "X").isMultiline); |
| 1604 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin
g("r'''X'''"), "X").isMultiline); | 1658 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin
g("r'''X'''"), "X").isMultiline); |
| 1605 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin
g("\"\"\"X\"\"\""), "X").isMultiline); | 1659 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin
g("\"\"\"X\"\"\""), "X").isMultiline); |
| 1606 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin
g("r\"\"\"X\"\"\""), "X").isMultiline); | 1660 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin
g("r\"\"\"X\"\"\""), "X").isMultiline); |
| 1607 } | 1661 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1637 runJUnitTest(__test, __test.test_contentsEnd); | 1691 runJUnitTest(__test, __test.test_contentsEnd); |
| 1638 }); | 1692 }); |
| 1639 _ut.test('test_isMultiline', () { | 1693 _ut.test('test_isMultiline', () { |
| 1640 final __test = new SimpleStringLiteralTest(); | 1694 final __test = new SimpleStringLiteralTest(); |
| 1641 runJUnitTest(__test, __test.test_isMultiline); | 1695 runJUnitTest(__test, __test.test_isMultiline); |
| 1642 }); | 1696 }); |
| 1643 _ut.test('test_isRaw', () { | 1697 _ut.test('test_isRaw', () { |
| 1644 final __test = new SimpleStringLiteralTest(); | 1698 final __test = new SimpleStringLiteralTest(); |
| 1645 runJUnitTest(__test, __test.test_isRaw); | 1699 runJUnitTest(__test, __test.test_isRaw); |
| 1646 }); | 1700 }); |
| 1701 _ut.test('test_isSingleQuoted', () { |
| 1702 final __test = new SimpleStringLiteralTest(); |
| 1703 runJUnitTest(__test, __test.test_isSingleQuoted); |
| 1704 }); |
| 1705 _ut.test('test_isSingleQuoted_raw', () { |
| 1706 final __test = new SimpleStringLiteralTest(); |
| 1707 runJUnitTest(__test, __test.test_isSingleQuoted_raw); |
| 1708 }); |
| 1647 _ut.test('test_simple', () { | 1709 _ut.test('test_simple', () { |
| 1648 final __test = new SimpleStringLiteralTest(); | 1710 final __test = new SimpleStringLiteralTest(); |
| 1649 runJUnitTest(__test, __test.test_simple); | 1711 runJUnitTest(__test, __test.test_simple); |
| 1650 }); | 1712 }); |
| 1651 }); | 1713 }); |
| 1652 } | 1714 } |
| 1653 } | 1715 } |
| 1654 | 1716 |
| 1655 class StringInterpolationTest extends ParserTestCase { | 1717 class StringInterpolationTest extends ParserTestCase { |
| 1656 void test_contentsOffsetEnd() { | 1718 void test_contentsOffsetEnd() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1704 { | 1766 { |
| 1705 var ae = AstFactory.interpolationString('r"""a', "a"); | 1767 var ae = AstFactory.interpolationString('r"""a', "a"); |
| 1706 var cToken = new StringToken(TokenType.STRING, 'ccc"""', 10); | 1768 var cToken = new StringToken(TokenType.STRING, 'ccc"""', 10); |
| 1707 var cElement = new InterpolationString(cToken, 'ccc'); | 1769 var cElement = new InterpolationString(cToken, 'ccc'); |
| 1708 StringInterpolation node = AstFactory.string([ae, ae, cElement]); | 1770 StringInterpolation node = AstFactory.string([ae, ae, cElement]); |
| 1709 JUnitTestCase.assertEquals(4, node.contentsOffset); | 1771 JUnitTestCase.assertEquals(4, node.contentsOffset); |
| 1710 JUnitTestCase.assertEquals(10 + 4 - 1, node.contentsEnd); | 1772 JUnitTestCase.assertEquals(10 + 4 - 1, node.contentsEnd); |
| 1711 } | 1773 } |
| 1712 } | 1774 } |
| 1713 | 1775 |
| 1776 void test_isMultiline() { |
| 1777 var b = AstFactory.interpolationExpression(AstFactory.identifier3('bb')); |
| 1778 // ' |
| 1779 { |
| 1780 var a = AstFactory.interpolationString("'a", "a"); |
| 1781 var c = AstFactory.interpolationString("ccc'", "ccc"); |
| 1782 StringInterpolation node = AstFactory.string([a, b, c]); |
| 1783 JUnitTestCase.assertFalse(node.isMultiline); |
| 1784 } |
| 1785 // ''' |
| 1786 { |
| 1787 var a = AstFactory.interpolationString("'''a", "a"); |
| 1788 var c = AstFactory.interpolationString("ccc'''", "ccc"); |
| 1789 StringInterpolation node = AstFactory.string([a, b, c]); |
| 1790 JUnitTestCase.assertTrue(node.isMultiline); |
| 1791 } |
| 1792 // " |
| 1793 { |
| 1794 var a = AstFactory.interpolationString('"a', "a"); |
| 1795 var c = AstFactory.interpolationString('ccc"', "ccc"); |
| 1796 StringInterpolation node = AstFactory.string([a, b, c]); |
| 1797 JUnitTestCase.assertFalse(node.isMultiline); |
| 1798 } |
| 1799 // """ |
| 1800 { |
| 1801 var a = AstFactory.interpolationString('"""a', "a"); |
| 1802 var c = AstFactory.interpolationString('ccc"""', "ccc"); |
| 1803 StringInterpolation node = AstFactory.string([a, b, c]); |
| 1804 JUnitTestCase.assertTrue(node.isMultiline); |
| 1805 } |
| 1806 } |
| 1807 |
| 1808 void test_isSingleQuoted() { |
| 1809 var b = AstFactory.interpolationExpression(AstFactory.identifier3('bb')); |
| 1810 // " |
| 1811 { |
| 1812 var a = AstFactory.interpolationString('"a', "a"); |
| 1813 var c = AstFactory.interpolationString('ccc"', "ccc"); |
| 1814 StringInterpolation node = AstFactory.string([a, b, c]); |
| 1815 JUnitTestCase.assertFalse(node.isSingleQuoted); |
| 1816 } |
| 1817 // """ |
| 1818 { |
| 1819 var a = AstFactory.interpolationString('"""a', "a"); |
| 1820 var c = AstFactory.interpolationString('ccc"""', "ccc"); |
| 1821 StringInterpolation node = AstFactory.string([a, b, c]); |
| 1822 JUnitTestCase.assertFalse(node.isSingleQuoted); |
| 1823 } |
| 1824 // ' |
| 1825 { |
| 1826 var a = AstFactory.interpolationString("'a", "a"); |
| 1827 var c = AstFactory.interpolationString("ccc'", "ccc"); |
| 1828 StringInterpolation node = AstFactory.string([a, b, c]); |
| 1829 JUnitTestCase.assertTrue(node.isSingleQuoted); |
| 1830 } |
| 1831 // ''' |
| 1832 { |
| 1833 var a = AstFactory.interpolationString("'''a", "a"); |
| 1834 var c = AstFactory.interpolationString("ccc'''", "ccc"); |
| 1835 StringInterpolation node = AstFactory.string([a, b, c]); |
| 1836 JUnitTestCase.assertTrue(node.isSingleQuoted); |
| 1837 } |
| 1838 } |
| 1839 |
| 1714 void test_isRaw() { | 1840 void test_isRaw() { |
| 1715 var ae = AstFactory.interpolationString("'a", "a"); | 1841 StringInterpolation node = AstFactory.string([]); |
| 1716 var be = AstFactory.interpolationExpression(AstFactory.identifier3('bb')); | |
| 1717 var cToken = new StringToken(TokenType.STRING, "ccc'", 10); | |
| 1718 var ce = new InterpolationString(cToken, 'ccc'); | |
| 1719 StringInterpolation node = AstFactory.string([ae, ae, ce]); | |
| 1720 JUnitTestCase.assertFalse(node.isRaw); | 1842 JUnitTestCase.assertFalse(node.isRaw); |
| 1721 } | 1843 } |
| 1722 | 1844 |
| 1723 static dartSuite() { | 1845 static dartSuite() { |
| 1724 _ut.group('StringInterpolationTest', () { | 1846 _ut.group('StringInterpolationTest', () { |
| 1725 _ut.test('test_contentsOffsetEnd', () { | 1847 _ut.test('test_contentsOffsetEnd', () { |
| 1726 final __test = new StringInterpolationTest(); | 1848 final __test = new StringInterpolationTest(); |
| 1727 runJUnitTest(__test, __test.test_contentsOffsetEnd); | 1849 runJUnitTest(__test, __test.test_contentsOffsetEnd); |
| 1728 }); | 1850 }); |
| 1851 _ut.test('test_isMultiline', () { |
| 1852 final __test = new StringInterpolationTest(); |
| 1853 runJUnitTest(__test, __test.test_isMultiline); |
| 1854 }); |
| 1729 _ut.test('test_isRaw', () { | 1855 _ut.test('test_isRaw', () { |
| 1730 final __test = new StringInterpolationTest(); | 1856 final __test = new StringInterpolationTest(); |
| 1731 runJUnitTest(__test, __test.test_isRaw); | 1857 runJUnitTest(__test, __test.test_isRaw); |
| 1732 }); | 1858 }); |
| 1859 _ut.test('test_isSingleQuoted', () { |
| 1860 final __test = new StringInterpolationTest(); |
| 1861 runJUnitTest(__test, __test.test_isSingleQuoted); |
| 1862 }); |
| 1733 }); | 1863 }); |
| 1734 } | 1864 } |
| 1735 } | 1865 } |
| 1736 | 1866 |
| 1737 class ToSourceVisitorTest extends EngineTestCase { | 1867 class ToSourceVisitorTest extends EngineTestCase { |
| 1738 void test_visitAdjacentStrings() { | 1868 void test_visitAdjacentStrings() { |
| 1739 _assertSource("'a' 'b'", AstFactory.adjacentStrings([AstFactory.string2("a")
, AstFactory.string2("b")])); | 1869 _assertSource("'a' 'b'", AstFactory.adjacentStrings([AstFactory.string2("a")
, AstFactory.string2("b")])); |
| 1740 } | 1870 } |
| 1741 | 1871 |
| 1742 void test_visitAnnotation_constant() { | 1872 void test_visitAnnotation_constant() { |
| (...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4149 BreadthFirstVisitorTest.dartSuite(); | 4279 BreadthFirstVisitorTest.dartSuite(); |
| 4150 ClassDeclarationTest.dartSuite(); | 4280 ClassDeclarationTest.dartSuite(); |
| 4151 ClassTypeAliasTest.dartSuite(); | 4281 ClassTypeAliasTest.dartSuite(); |
| 4152 IndexExpressionTest.dartSuite(); | 4282 IndexExpressionTest.dartSuite(); |
| 4153 NodeListTest.dartSuite(); | 4283 NodeListTest.dartSuite(); |
| 4154 SimpleIdentifierTest.dartSuite(); | 4284 SimpleIdentifierTest.dartSuite(); |
| 4155 SimpleStringLiteralTest.dartSuite(); | 4285 SimpleStringLiteralTest.dartSuite(); |
| 4156 StringInterpolationTest.dartSuite(); | 4286 StringInterpolationTest.dartSuite(); |
| 4157 VariableDeclarationTest.dartSuite(); | 4287 VariableDeclarationTest.dartSuite(); |
| 4158 } | 4288 } |
| OLD | NEW |