Mercurial > vim
comparison src/testdir/test_normal.vim @ 16720:9c90cf08cfa8 v8.1.1362
patch 8.1.1362: code and data in tests can be hard to read
commit https://github.com/vim/vim/commit/c79745a82faeb5a6058e915ca49a4c69fa60ea01
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon May 20 22:12:34 2019 +0200
patch 8.1.1362: code and data in tests can be hard to read
Problem: Code and data in tests can be hard to read.
Solution: Use the new heredoc style. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/4400)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 20 May 2019 22:15:06 +0200 |
parents | aebcd20a8a3f |
children | 6990c1160ea5 |
comparison
equal
deleted
inserted
replaced
16719:27f2a2799604 | 16720:9c90cf08cfa8 |
---|---|
1553 bw! | 1553 bw! |
1554 endfunc | 1554 endfunc |
1555 | 1555 |
1556 fun! Test_normal29_brace() | 1556 fun! Test_normal29_brace() |
1557 " basic test for { and } movements | 1557 " basic test for { and } movements |
1558 let text= ['A paragraph begins after each empty line, and also at each of a set of', | 1558 let text =<< trim [DATA] |
1559 \ 'paragraph macros, specified by the pairs of characters in the ''paragraphs''', | 1559 A paragraph begins after each empty line, and also at each of a set of |
1560 \ 'option. The default is "IPLPPPQPP TPHPLIPpLpItpplpipbp", which corresponds to', | 1560 paragraph macros, specified by the pairs of characters in the 'paragraphs' |
1561 \ 'the macros ".IP", ".LP", etc. (These are nroff macros, so the dot must be in', | 1561 option. The default is "IPLPPPQPP TPHPLIPpLpItpplpipbp", which corresponds to |
1562 \ 'the first column). A section boundary is also a paragraph boundary.', | 1562 the macros ".IP", ".LP", etc. (These are nroff macros, so the dot must be in |
1563 \ 'Note that a blank line (only containing white space) is NOT a paragraph', | 1563 the first column). A section boundary is also a paragraph boundary. |
1564 \ 'boundary.', | 1564 Note that a blank line (only containing white space) is NOT a paragraph |
1565 \ '', | 1565 boundary. |
1566 \ '', | 1566 |
1567 \ 'Also note that this does not include a ''{'' or ''}'' in the first column. When', | 1567 |
1568 \ 'the ''{'' flag is in ''cpoptions'' then ''{'' in the first column is used as a', | 1568 Also note that this does not include a '{' or '}' in the first column. When |
1569 \ 'paragraph boundary |posix|.', | 1569 the '{' flag is in 'cpoptions' then '{' in the first column is used as a |
1570 \ '{', | 1570 paragraph boundary |posix|. |
1571 \ 'This is no paragraph', | 1571 { |
1572 \ 'unless the ''{'' is set', | 1572 This is no paragraph |
1573 \ 'in ''cpoptions''', | 1573 unless the '{' is set |
1574 \ '}', | 1574 in 'cpoptions' |
1575 \ '.IP', | 1575 } |
1576 \ 'The nroff macros IP separates a paragraph', | 1576 .IP |
1577 \ 'That means, it must be a ''.''', | 1577 The nroff macros IP separates a paragraph |
1578 \ 'followed by IP', | 1578 That means, it must be a '.' |
1579 \ '.LPIt does not matter, if afterwards some', | 1579 followed by IP |
1580 \ 'more characters follow.', | 1580 .LPIt does not matter, if afterwards some |
1581 \ '.SHAlso section boundaries from the nroff', | 1581 more characters follow. |
1582 \ 'macros terminate a paragraph. That means', | 1582 .SHAlso section boundaries from the nroff |
1583 \ 'a character like this:', | 1583 macros terminate a paragraph. That means |
1584 \ '.NH', | 1584 a character like this: |
1585 \ 'End of text here'] | 1585 .NH |
1586 End of text here | |
1587 [DATA] | |
1588 | |
1586 new | 1589 new |
1587 call append(0, text) | 1590 call append(0, text) |
1588 1 | 1591 1 |
1589 norm! 0d2} | 1592 norm! 0d2} |
1590 call assert_equal(['.IP', | 1593 |
1591 \ 'The nroff macros IP separates a paragraph', 'That means, it must be a ''.''', 'followed by IP', | 1594 let expected =<< trim [DATA] |
1592 \ '.LPIt does not matter, if afterwards some', 'more characters follow.', '.SHAlso section boundaries from the nroff', | 1595 .IP |
1593 \ 'macros terminate a paragraph. That means', 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$')) | 1596 The nroff macros IP separates a paragraph |
1597 That means, it must be a '.' | |
1598 followed by IP | |
1599 .LPIt does not matter, if afterwards some | |
1600 more characters follow. | |
1601 .SHAlso section boundaries from the nroff | |
1602 macros terminate a paragraph. That means | |
1603 a character like this: | |
1604 .NH | |
1605 End of text here | |
1606 | |
1607 [DATA] | |
1608 call assert_equal(expected, getline(1, '$')) | |
1609 | |
1594 norm! 0d} | 1610 norm! 0d} |
1595 call assert_equal(['.LPIt does not matter, if afterwards some', 'more characters follow.', | 1611 |
1596 \ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means', | 1612 let expected =<< trim [DATA] |
1597 \ 'a character like this:', '.NH', 'End of text here', ''], getline(1, '$')) | 1613 .LPIt does not matter, if afterwards some |
1614 more characters follow. | |
1615 .SHAlso section boundaries from the nroff | |
1616 macros terminate a paragraph. That means | |
1617 a character like this: | |
1618 .NH | |
1619 End of text here | |
1620 | |
1621 [DATA] | |
1622 call assert_equal(expected, getline(1, '$')) | |
1623 | |
1598 $ | 1624 $ |
1599 norm! d{ | 1625 norm! d{ |
1600 call assert_equal(['.LPIt does not matter, if afterwards some', 'more characters follow.', | 1626 |
1601 \ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means', 'a character like this:', ''], getline(1, '$')) | 1627 let expected =<< trim [DATA] |
1628 .LPIt does not matter, if afterwards some | |
1629 more characters follow. | |
1630 .SHAlso section boundaries from the nroff | |
1631 macros terminate a paragraph. That means | |
1632 a character like this: | |
1633 | |
1634 [DATA] | |
1635 call assert_equal(expected, getline(1, '$')) | |
1636 | |
1602 norm! d{ | 1637 norm! d{ |
1603 call assert_equal(['.LPIt does not matter, if afterwards some', 'more characters follow.', ''], getline(1,'$')) | 1638 |
1639 let expected =<< trim [DATA] | |
1640 .LPIt does not matter, if afterwards some | |
1641 more characters follow. | |
1642 | |
1643 [DATA] | |
1644 call assert_equal(expected, getline(1, '$')) | |
1645 | |
1604 " Test with { in cpooptions | 1646 " Test with { in cpooptions |
1605 %d | 1647 %d |
1606 call append(0, text) | 1648 call append(0, text) |
1607 set cpo+={ | 1649 set cpo+={ |
1608 1 | 1650 1 |
1609 norm! 0d2} | 1651 norm! 0d2} |
1610 call assert_equal(['{', 'This is no paragraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}', | 1652 |
1611 \ '.IP', 'The nroff macros IP separates a paragraph', 'That means, it must be a ''.''', | 1653 let expected =<< trim [DATA] |
1612 \ 'followed by IP', '.LPIt does not matter, if afterwards some', 'more characters follow.', | 1654 { |
1613 \ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means', | 1655 This is no paragraph |
1614 \ 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$')) | 1656 unless the '{' is set |
1657 in 'cpoptions' | |
1658 } | |
1659 .IP | |
1660 The nroff macros IP separates a paragraph | |
1661 That means, it must be a '.' | |
1662 followed by IP | |
1663 .LPIt does not matter, if afterwards some | |
1664 more characters follow. | |
1665 .SHAlso section boundaries from the nroff | |
1666 macros terminate a paragraph. That means | |
1667 a character like this: | |
1668 .NH | |
1669 End of text here | |
1670 | |
1671 [DATA] | |
1672 call assert_equal(expected, getline(1, '$')) | |
1673 | |
1615 $ | 1674 $ |
1616 norm! d} | 1675 norm! d} |
1617 call assert_equal(['{', 'This is no paragraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}', | 1676 |
1618 \ '.IP', 'The nroff macros IP separates a paragraph', 'That means, it must be a ''.''', | 1677 let expected =<< trim [DATA] |
1619 \ 'followed by IP', '.LPIt does not matter, if afterwards some', 'more characters follow.', | 1678 { |
1620 \ '.SHAlso section boundaries from the nroff', 'macros terminate a paragraph. That means', | 1679 This is no paragraph |
1621 \ 'a character like this:', '.NH', 'End of text here', ''], getline(1,'$')) | 1680 unless the '{' is set |
1681 in 'cpoptions' | |
1682 } | |
1683 .IP | |
1684 The nroff macros IP separates a paragraph | |
1685 That means, it must be a '.' | |
1686 followed by IP | |
1687 .LPIt does not matter, if afterwards some | |
1688 more characters follow. | |
1689 .SHAlso section boundaries from the nroff | |
1690 macros terminate a paragraph. That means | |
1691 a character like this: | |
1692 .NH | |
1693 End of text here | |
1694 | |
1695 [DATA] | |
1696 call assert_equal(expected, getline(1, '$')) | |
1697 | |
1622 norm! gg} | 1698 norm! gg} |
1623 norm! d5} | 1699 norm! d5} |
1624 call assert_equal(['{', 'This is no paragraph', 'unless the ''{'' is set', 'in ''cpoptions''', '}', ''], getline(1,'$')) | 1700 |
1701 let expected =<< trim [DATA] | |
1702 { | |
1703 This is no paragraph | |
1704 unless the '{' is set | |
1705 in 'cpoptions' | |
1706 } | |
1707 | |
1708 [DATA] | |
1709 call assert_equal(expected, getline(1, '$')) | |
1625 | 1710 |
1626 " clean up | 1711 " clean up |
1627 set cpo-={ | 1712 set cpo-={ |
1628 bw! | 1713 bw! |
1629 endfunc | 1714 endfunc |