Chromium Code Reviews| 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 | |
| 1598 void test_isMultiline() { | 1625 void test_isMultiline() { |
| 1599 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri ng("'X'"), "X").isMultiline); | 1626 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri ng("'X'"), "X").isMultiline); |
| 1600 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri ng("r'X'"), "X").isMultiline); | 1627 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri ng("r'X'"), "X").isMultiline); |
| 1601 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri ng("\"X\""), "X").isMultiline); | 1628 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri ng("\"X\""), "X").isMultiline); |
| 1602 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri ng("r\"X\""), "X").isMultiline); | 1629 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri ng("r\"X\""), "X").isMultiline); |
| 1603 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin g("'''X'''"), "X").isMultiline); | 1630 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin g("'''X'''"), "X").isMultiline); |
| 1604 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin g("r'''X'''"), "X").isMultiline); | 1631 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin g("r'''X'''"), "X").isMultiline); |
| 1605 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin g("\"\"\"X\"\"\""), "X").isMultiline); | 1632 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin g("\"\"\"X\"\"\""), "X").isMultiline); |
| 1606 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin g("r\"\"\"X\"\"\""), "X").isMultiline); | 1633 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin g("r\"\"\"X\"\"\""), "X").isMultiline); |
| 1607 } | 1634 } |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 1637 runJUnitTest(__test, __test.test_contentsEnd); | 1664 runJUnitTest(__test, __test.test_contentsEnd); |
| 1638 }); | 1665 }); |
| 1639 _ut.test('test_isMultiline', () { | 1666 _ut.test('test_isMultiline', () { |
| 1640 final __test = new SimpleStringLiteralTest(); | 1667 final __test = new SimpleStringLiteralTest(); |
| 1641 runJUnitTest(__test, __test.test_isMultiline); | 1668 runJUnitTest(__test, __test.test_isMultiline); |
| 1642 }); | 1669 }); |
| 1643 _ut.test('test_isRaw', () { | 1670 _ut.test('test_isRaw', () { |
| 1644 final __test = new SimpleStringLiteralTest(); | 1671 final __test = new SimpleStringLiteralTest(); |
| 1645 runJUnitTest(__test, __test.test_isRaw); | 1672 runJUnitTest(__test, __test.test_isRaw); |
| 1646 }); | 1673 }); |
| 1674 _ut.test('test_isSingleQuoted', () { | |
| 1675 final __test = new SimpleStringLiteralTest(); | |
| 1676 runJUnitTest(__test, __test.test_isSingleQuoted); | |
| 1677 }); | |
| 1647 _ut.test('test_simple', () { | 1678 _ut.test('test_simple', () { |
| 1648 final __test = new SimpleStringLiteralTest(); | 1679 final __test = new SimpleStringLiteralTest(); |
| 1649 runJUnitTest(__test, __test.test_simple); | 1680 runJUnitTest(__test, __test.test_simple); |
| 1650 }); | 1681 }); |
| 1651 }); | 1682 }); |
| 1652 } | 1683 } |
| 1653 } | 1684 } |
| 1654 | 1685 |
| 1655 class StringInterpolationTest extends ParserTestCase { | 1686 class StringInterpolationTest extends ParserTestCase { |
| 1656 void test_contentsOffsetEnd() { | 1687 void test_contentsOffsetEnd() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1704 { | 1735 { |
| 1705 var ae = AstFactory.interpolationString('r"""a', "a"); | 1736 var ae = AstFactory.interpolationString('r"""a', "a"); |
| 1706 var cToken = new StringToken(TokenType.STRING, 'ccc"""', 10); | 1737 var cToken = new StringToken(TokenType.STRING, 'ccc"""', 10); |
| 1707 var cElement = new InterpolationString(cToken, 'ccc'); | 1738 var cElement = new InterpolationString(cToken, 'ccc'); |
| 1708 StringInterpolation node = AstFactory.string([ae, ae, cElement]); | 1739 StringInterpolation node = AstFactory.string([ae, ae, cElement]); |
| 1709 JUnitTestCase.assertEquals(4, node.contentsOffset); | 1740 JUnitTestCase.assertEquals(4, node.contentsOffset); |
| 1710 JUnitTestCase.assertEquals(10 + 4 - 1, node.contentsEnd); | 1741 JUnitTestCase.assertEquals(10 + 4 - 1, node.contentsEnd); |
| 1711 } | 1742 } |
| 1712 } | 1743 } |
| 1713 | 1744 |
| 1745 void test_isMultiline() { | |
|
Brian Wilkerson
2014/10/07 14:12:04
It wouldn't hurt to test this method with double-q
scheglov
2014/10/07 15:37:57
Done.
| |
| 1746 // false | |
| 1747 { | |
| 1748 var ae = AstFactory.interpolationString("'a", "a"); | |
| 1749 var be = AstFactory.interpolationExpression(AstFactory.identifier3('bb')); | |
| 1750 var ce = AstFactory.interpolationString("ccc'", "ccc"); | |
| 1751 StringInterpolation node = AstFactory.string([ae, ae, ce]); | |
| 1752 JUnitTestCase.assertFalse(node.isMultiline); | |
| 1753 } | |
| 1754 // true | |
| 1755 { | |
| 1756 var ae = AstFactory.interpolationString("'''a", "a"); | |
| 1757 var be = AstFactory.interpolationExpression(AstFactory.identifier3('bb')); | |
| 1758 var ce = AstFactory.interpolationString("ccc'''", "ccc"); | |
| 1759 StringInterpolation node = AstFactory.string([ae, ae, ce]); | |
| 1760 JUnitTestCase.assertTrue(node.isMultiline); | |
| 1761 } | |
| 1762 } | |
| 1763 | |
| 1764 void test_isSingleQuoted() { | |
|
Brian Wilkerson
2014/10/07 14:12:04
It wouldn't hurt to test this method with multi-li
scheglov
2014/10/07 15:37:56
Done.
| |
| 1765 // false | |
| 1766 { | |
| 1767 var ae = AstFactory.interpolationString('"a', "a"); | |
| 1768 var be = AstFactory.interpolationExpression(AstFactory.identifier3('bb')); | |
| 1769 var ce = AstFactory.interpolationString('ccc"', "ccc"); | |
| 1770 StringInterpolation node = AstFactory.string([ae, ae, ce]); | |
| 1771 JUnitTestCase.assertFalse(node.isSingleQuoted); | |
| 1772 } | |
| 1773 // true | |
| 1774 { | |
| 1775 var ae = AstFactory.interpolationString("'a", "a"); | |
| 1776 var be = AstFactory.interpolationExpression(AstFactory.identifier3('bb')); | |
| 1777 var ce = AstFactory.interpolationString("ccc'", "ccc"); | |
| 1778 StringInterpolation node = AstFactory.string([ae, ae, ce]); | |
| 1779 JUnitTestCase.assertTrue(node.isSingleQuoted); | |
| 1780 } | |
| 1781 } | |
| 1782 | |
| 1714 void test_isRaw() { | 1783 void test_isRaw() { |
| 1715 var ae = AstFactory.interpolationString("'a", "a"); | 1784 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); | 1785 JUnitTestCase.assertFalse(node.isRaw); |
| 1721 } | 1786 } |
| 1722 | 1787 |
| 1723 static dartSuite() { | 1788 static dartSuite() { |
| 1724 _ut.group('StringInterpolationTest', () { | 1789 _ut.group('StringInterpolationTest', () { |
| 1725 _ut.test('test_contentsOffsetEnd', () { | 1790 _ut.test('test_contentsOffsetEnd', () { |
| 1726 final __test = new StringInterpolationTest(); | 1791 final __test = new StringInterpolationTest(); |
| 1727 runJUnitTest(__test, __test.test_contentsOffsetEnd); | 1792 runJUnitTest(__test, __test.test_contentsOffsetEnd); |
| 1728 }); | 1793 }); |
| 1794 _ut.test('test_isMultiline', () { | |
| 1795 final __test = new StringInterpolationTest(); | |
| 1796 runJUnitTest(__test, __test.test_isMultiline); | |
| 1797 }); | |
| 1729 _ut.test('test_isRaw', () { | 1798 _ut.test('test_isRaw', () { |
| 1730 final __test = new StringInterpolationTest(); | 1799 final __test = new StringInterpolationTest(); |
| 1731 runJUnitTest(__test, __test.test_isRaw); | 1800 runJUnitTest(__test, __test.test_isRaw); |
| 1732 }); | 1801 }); |
| 1802 _ut.test('test_isSingleQuoted', () { | |
| 1803 final __test = new StringInterpolationTest(); | |
| 1804 runJUnitTest(__test, __test.test_isSingleQuoted); | |
| 1805 }); | |
| 1733 }); | 1806 }); |
| 1734 } | 1807 } |
| 1735 } | 1808 } |
| 1736 | 1809 |
| 1737 class ToSourceVisitorTest extends EngineTestCase { | 1810 class ToSourceVisitorTest extends EngineTestCase { |
| 1738 void test_visitAdjacentStrings() { | 1811 void test_visitAdjacentStrings() { |
| 1739 _assertSource("'a' 'b'", AstFactory.adjacentStrings([AstFactory.string2("a") , AstFactory.string2("b")])); | 1812 _assertSource("'a' 'b'", AstFactory.adjacentStrings([AstFactory.string2("a") , AstFactory.string2("b")])); |
| 1740 } | 1813 } |
| 1741 | 1814 |
| 1742 void test_visitAnnotation_constant() { | 1815 void test_visitAnnotation_constant() { |
| (...skipping 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4149 BreadthFirstVisitorTest.dartSuite(); | 4222 BreadthFirstVisitorTest.dartSuite(); |
| 4150 ClassDeclarationTest.dartSuite(); | 4223 ClassDeclarationTest.dartSuite(); |
| 4151 ClassTypeAliasTest.dartSuite(); | 4224 ClassTypeAliasTest.dartSuite(); |
| 4152 IndexExpressionTest.dartSuite(); | 4225 IndexExpressionTest.dartSuite(); |
| 4153 NodeListTest.dartSuite(); | 4226 NodeListTest.dartSuite(); |
| 4154 SimpleIdentifierTest.dartSuite(); | 4227 SimpleIdentifierTest.dartSuite(); |
| 4155 SimpleStringLiteralTest.dartSuite(); | 4228 SimpleStringLiteralTest.dartSuite(); |
| 4156 StringInterpolationTest.dartSuite(); | 4229 StringInterpolationTest.dartSuite(); |
| 4157 VariableDeclarationTest.dartSuite(); | 4230 VariableDeclarationTest.dartSuite(); |
| 4158 } | 4231 } |
| OLD | NEW |