| 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 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 }); | 1566 }); |
| 1567 _ut.test('test_isQualified_inReturnStatement', () { | 1567 _ut.test('test_isQualified_inReturnStatement', () { |
| 1568 final __test = new SimpleIdentifierTest(); | 1568 final __test = new SimpleIdentifierTest(); |
| 1569 runJUnitTest(__test, __test.test_isQualified_inReturnStatement); | 1569 runJUnitTest(__test, __test.test_isQualified_inReturnStatement); |
| 1570 }); | 1570 }); |
| 1571 }); | 1571 }); |
| 1572 } | 1572 } |
| 1573 } | 1573 } |
| 1574 | 1574 |
| 1575 class SimpleStringLiteralTest extends ParserTestCase { | 1575 class SimpleStringLiteralTest extends ParserTestCase { |
| 1576 void test_getValueOffset() { | 1576 void test_contentsOffset() { |
| 1577 JUnitTestCase.assertEquals(1, new SimpleStringLiteral(TokenFactory.tokenFrom
String("'X'"), "X").valueOffset); | 1577 JUnitTestCase.assertEquals(1, new SimpleStringLiteral(TokenFactory.tokenFrom
String("'X'"), "X").contentsOffset); |
| 1578 JUnitTestCase.assertEquals(1, new SimpleStringLiteral(TokenFactory.tokenFrom
String("\"X\""), "X").valueOffset); | 1578 JUnitTestCase.assertEquals(1, new SimpleStringLiteral(TokenFactory.tokenFrom
String("\"X\""), "X").contentsOffset); |
| 1579 JUnitTestCase.assertEquals(3, new SimpleStringLiteral(TokenFactory.tokenFrom
String("\"\"\"X\"\"\""), "X").valueOffset); | 1579 JUnitTestCase.assertEquals(3, new SimpleStringLiteral(TokenFactory.tokenFrom
String("\"\"\"X\"\"\""), "X").contentsOffset); |
| 1580 JUnitTestCase.assertEquals(3, new SimpleStringLiteral(TokenFactory.tokenFrom
String("'''X'''"), "X").valueOffset); | 1580 JUnitTestCase.assertEquals(3, new SimpleStringLiteral(TokenFactory.tokenFrom
String("'''X'''"), "X").contentsOffset); |
| 1581 JUnitTestCase.assertEquals(2, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r'X'"), "X").valueOffset); | 1581 JUnitTestCase.assertEquals(2, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r'X'"), "X").contentsOffset); |
| 1582 JUnitTestCase.assertEquals(2, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r\"X\""), "X").valueOffset); | 1582 JUnitTestCase.assertEquals(2, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r\"X\""), "X").contentsOffset); |
| 1583 JUnitTestCase.assertEquals(4, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r\"\"\"X\"\"\""), "X").valueOffset); | 1583 JUnitTestCase.assertEquals(4, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r\"\"\"X\"\"\""), "X").contentsOffset); |
| 1584 JUnitTestCase.assertEquals(4, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r'''X'''"), "X").valueOffset); | 1584 JUnitTestCase.assertEquals(4, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r'''X'''"), "X").contentsOffset); |
| 1585 } |
| 1586 |
| 1587 void test_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); |
| 1590 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); |
| 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); |
| 1595 JUnitTestCase.assertEquals(5, new SimpleStringLiteral(TokenFactory.tokenFrom
String("r'''X'''"), "X").contentsEnd); |
| 1585 } | 1596 } |
| 1586 | 1597 |
| 1587 void test_isMultiline() { | 1598 void test_isMultiline() { |
| 1588 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("'X'"), "X").isMultiline); | 1599 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("'X'"), "X").isMultiline); |
| 1589 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("r'X'"), "X").isMultiline); | 1600 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("r'X'"), "X").isMultiline); |
| 1590 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("\"X\""), "X").isMultiline); | 1601 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("\"X\""), "X").isMultiline); |
| 1591 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("r\"X\""), "X").isMultiline); | 1602 JUnitTestCase.assertFalse(new SimpleStringLiteral(TokenFactory.tokenFromStri
ng("r\"X\""), "X").isMultiline); |
| 1592 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin
g("'''X'''"), "X").isMultiline); | 1603 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin
g("'''X'''"), "X").isMultiline); |
| 1593 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin
g("r'''X'''"), "X").isMultiline); | 1604 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin
g("r'''X'''"), "X").isMultiline); |
| 1594 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin
g("\"\"\"X\"\"\""), "X").isMultiline); | 1605 JUnitTestCase.assertTrue(new SimpleStringLiteral(TokenFactory.tokenFromStrin
g("\"\"\"X\"\"\""), "X").isMultiline); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1610 Token token = TokenFactory.tokenFromString("'value'"); | 1621 Token token = TokenFactory.tokenFromString("'value'"); |
| 1611 SimpleStringLiteral stringLiteral = new SimpleStringLiteral(token, "value"); | 1622 SimpleStringLiteral stringLiteral = new SimpleStringLiteral(token, "value"); |
| 1612 JUnitTestCase.assertSame(token, stringLiteral.literal); | 1623 JUnitTestCase.assertSame(token, stringLiteral.literal); |
| 1613 JUnitTestCase.assertSame(token, stringLiteral.beginToken); | 1624 JUnitTestCase.assertSame(token, stringLiteral.beginToken); |
| 1614 JUnitTestCase.assertSame(token, stringLiteral.endToken); | 1625 JUnitTestCase.assertSame(token, stringLiteral.endToken); |
| 1615 JUnitTestCase.assertEquals("value", stringLiteral.value); | 1626 JUnitTestCase.assertEquals("value", stringLiteral.value); |
| 1616 } | 1627 } |
| 1617 | 1628 |
| 1618 static dartSuite() { | 1629 static dartSuite() { |
| 1619 _ut.group('SimpleStringLiteralTest', () { | 1630 _ut.group('SimpleStringLiteralTest', () { |
| 1620 _ut.test('test_getValueOffset', () { | 1631 _ut.test('test_contentsOffset', () { |
| 1621 final __test = new SimpleStringLiteralTest(); | 1632 final __test = new SimpleStringLiteralTest(); |
| 1622 runJUnitTest(__test, __test.test_getValueOffset); | 1633 runJUnitTest(__test, __test.test_contentsOffset); |
| 1634 }); |
| 1635 _ut.test('test_contentsEnd', () { |
| 1636 final __test = new SimpleStringLiteralTest(); |
| 1637 runJUnitTest(__test, __test.test_contentsEnd); |
| 1623 }); | 1638 }); |
| 1624 _ut.test('test_isMultiline', () { | 1639 _ut.test('test_isMultiline', () { |
| 1625 final __test = new SimpleStringLiteralTest(); | 1640 final __test = new SimpleStringLiteralTest(); |
| 1626 runJUnitTest(__test, __test.test_isMultiline); | 1641 runJUnitTest(__test, __test.test_isMultiline); |
| 1627 }); | 1642 }); |
| 1628 _ut.test('test_isRaw', () { | 1643 _ut.test('test_isRaw', () { |
| 1629 final __test = new SimpleStringLiteralTest(); | 1644 final __test = new SimpleStringLiteralTest(); |
| 1630 runJUnitTest(__test, __test.test_isRaw); | 1645 runJUnitTest(__test, __test.test_isRaw); |
| 1631 }); | 1646 }); |
| 1632 _ut.test('test_simple', () { | 1647 _ut.test('test_simple', () { |
| 1633 final __test = new SimpleStringLiteralTest(); | 1648 final __test = new SimpleStringLiteralTest(); |
| 1634 runJUnitTest(__test, __test.test_simple); | 1649 runJUnitTest(__test, __test.test_simple); |
| 1635 }); | 1650 }); |
| 1636 }); | 1651 }); |
| 1637 } | 1652 } |
| 1638 } | 1653 } |
| 1639 | 1654 |
| 1655 class StringInterpolationTest extends ParserTestCase { |
| 1656 void test_contentsOffsetEnd() { |
| 1657 var be = AstFactory.interpolationExpression(AstFactory.identifier3('bb')); |
| 1658 // 'a${bb}ccc' |
| 1659 { |
| 1660 var ae = AstFactory.interpolationString("'a", "a"); |
| 1661 var cToken = new StringToken(TokenType.STRING, "ccc'", 10); |
| 1662 var cElement = new InterpolationString(cToken, 'ccc'); |
| 1663 StringInterpolation node = AstFactory.string([ae, ae, cElement]); |
| 1664 JUnitTestCase.assertEquals(1, node.contentsOffset); |
| 1665 JUnitTestCase.assertEquals(10 + 4 - 1, node.contentsEnd); |
| 1666 } |
| 1667 // '''a${bb}ccc''' |
| 1668 { |
| 1669 var ae = AstFactory.interpolationString("'''a", "a"); |
| 1670 var cToken = new StringToken(TokenType.STRING, "ccc'''", 10); |
| 1671 var cElement = new InterpolationString(cToken, 'ccc'); |
| 1672 StringInterpolation node = AstFactory.string([ae, ae, cElement]); |
| 1673 JUnitTestCase.assertEquals(3, node.contentsOffset); |
| 1674 JUnitTestCase.assertEquals(10 + 4 - 1, node.contentsEnd); |
| 1675 } |
| 1676 // """a${bb}ccc""" |
| 1677 { |
| 1678 var ae = AstFactory.interpolationString('"""a', "a"); |
| 1679 var cToken = new StringToken(TokenType.STRING, 'ccc"""', 10); |
| 1680 var cElement = new InterpolationString(cToken, 'ccc'); |
| 1681 StringInterpolation node = AstFactory.string([ae, ae, cElement]); |
| 1682 JUnitTestCase.assertEquals(3, node.contentsOffset); |
| 1683 JUnitTestCase.assertEquals(10 + 4 - 1, node.contentsEnd); |
| 1684 } |
| 1685 // r'a${bb}ccc' |
| 1686 { |
| 1687 var ae = AstFactory.interpolationString("r'a", "a"); |
| 1688 var cToken = new StringToken(TokenType.STRING, "ccc'", 10); |
| 1689 var cElement = new InterpolationString(cToken, 'ccc'); |
| 1690 StringInterpolation node = AstFactory.string([ae, ae, cElement]); |
| 1691 JUnitTestCase.assertEquals(2, node.contentsOffset); |
| 1692 JUnitTestCase.assertEquals(10 + 4 - 1, node.contentsEnd); |
| 1693 } |
| 1694 // r'''a${bb}ccc''' |
| 1695 { |
| 1696 var ae = AstFactory.interpolationString("r'''a", "a"); |
| 1697 var cToken = new StringToken(TokenType.STRING, "ccc'''", 10); |
| 1698 var cElement = new InterpolationString(cToken, 'ccc'); |
| 1699 StringInterpolation node = AstFactory.string([ae, ae, cElement]); |
| 1700 JUnitTestCase.assertEquals(4, node.contentsOffset); |
| 1701 JUnitTestCase.assertEquals(10 + 4 - 1, node.contentsEnd); |
| 1702 } |
| 1703 // r"""a${bb}ccc""" |
| 1704 { |
| 1705 var ae = AstFactory.interpolationString('r"""a', "a"); |
| 1706 var cToken = new StringToken(TokenType.STRING, 'ccc"""', 10); |
| 1707 var cElement = new InterpolationString(cToken, 'ccc'); |
| 1708 StringInterpolation node = AstFactory.string([ae, ae, cElement]); |
| 1709 JUnitTestCase.assertEquals(4, node.contentsOffset); |
| 1710 JUnitTestCase.assertEquals(10 + 4 - 1, node.contentsEnd); |
| 1711 } |
| 1712 } |
| 1713 |
| 1714 void test_isRaw() { |
| 1715 var ae = AstFactory.interpolationString("'a", "a"); |
| 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); |
| 1721 } |
| 1722 |
| 1723 static dartSuite() { |
| 1724 _ut.group('StringInterpolationTest', () { |
| 1725 _ut.test('test_contentsOffsetEnd', () { |
| 1726 final __test = new StringInterpolationTest(); |
| 1727 runJUnitTest(__test, __test.test_contentsOffsetEnd); |
| 1728 }); |
| 1729 _ut.test('test_isRaw', () { |
| 1730 final __test = new StringInterpolationTest(); |
| 1731 runJUnitTest(__test, __test.test_isRaw); |
| 1732 }); |
| 1733 }); |
| 1734 } |
| 1735 } |
| 1736 |
| 1640 class ToSourceVisitorTest extends EngineTestCase { | 1737 class ToSourceVisitorTest extends EngineTestCase { |
| 1641 void test_visitAdjacentStrings() { | 1738 void test_visitAdjacentStrings() { |
| 1642 _assertSource("'a' 'b'", AstFactory.adjacentStrings([AstFactory.string2("a")
, AstFactory.string2("b")])); | 1739 _assertSource("'a' 'b'", AstFactory.adjacentStrings([AstFactory.string2("a")
, AstFactory.string2("b")])); |
| 1643 } | 1740 } |
| 1644 | 1741 |
| 1645 void test_visitAnnotation_constant() { | 1742 void test_visitAnnotation_constant() { |
| 1646 _assertSource("@A", AstFactory.annotation(AstFactory.identifier3("A"))); | 1743 _assertSource("@A", AstFactory.annotation(AstFactory.identifier3("A"))); |
| 1647 } | 1744 } |
| 1648 | 1745 |
| 1649 void test_visitAnnotation_constructor() { | 1746 void test_visitAnnotation_constructor() { |
| (...skipping 2399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4049 ConstantEvaluatorTest.dartSuite(); | 4146 ConstantEvaluatorTest.dartSuite(); |
| 4050 NodeLocatorTest.dartSuite(); | 4147 NodeLocatorTest.dartSuite(); |
| 4051 ToSourceVisitorTest.dartSuite(); | 4148 ToSourceVisitorTest.dartSuite(); |
| 4052 BreadthFirstVisitorTest.dartSuite(); | 4149 BreadthFirstVisitorTest.dartSuite(); |
| 4053 ClassDeclarationTest.dartSuite(); | 4150 ClassDeclarationTest.dartSuite(); |
| 4054 ClassTypeAliasTest.dartSuite(); | 4151 ClassTypeAliasTest.dartSuite(); |
| 4055 IndexExpressionTest.dartSuite(); | 4152 IndexExpressionTest.dartSuite(); |
| 4056 NodeListTest.dartSuite(); | 4153 NodeListTest.dartSuite(); |
| 4057 SimpleIdentifierTest.dartSuite(); | 4154 SimpleIdentifierTest.dartSuite(); |
| 4058 SimpleStringLiteralTest.dartSuite(); | 4155 SimpleStringLiteralTest.dartSuite(); |
| 4156 StringInterpolationTest.dartSuite(); |
| 4059 VariableDeclarationTest.dartSuite(); | 4157 VariableDeclarationTest.dartSuite(); |
| 4060 } | 4158 } |
| OLD | NEW |