Mercurial > vim
comparison src/testdir/test3.in @ 2968:c296c225736e v7.3.256
updated for version 7.3.256
Problem: Javascript indenting not sufficiently tested.
Solution: Add more tests. (Luc Deschenaux) Mark the lines that are indented
wrong.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 20 Jul 2011 15:09:43 +0200 |
parents | 9f71f5a526af |
children | 0ecfe54a273f |
comparison
equal
deleted
inserted
replaced
2967:42c8b385b993 | 2968:c296c225736e |
---|---|
1595 } | 1595 } |
1596 NAMESPACEEND | 1596 NAMESPACEEND |
1597 | 1597 |
1598 | 1598 |
1599 STARTTEST | 1599 STARTTEST |
1600 :set cino=J1 | 1600 :set cino=j1,J1 |
1601 /^JSSTART | 1601 /^JSSTART |
1602 =/^JSEND | 1602 =/^JSEND |
1603 ENDTEST | 1603 ENDTEST |
1604 | 1604 |
1605 JSSTART | 1605 JSSTART |
1616 } | 1616 } |
1617 } | 1617 } |
1618 JSEND | 1618 JSEND |
1619 | 1619 |
1620 STARTTEST | 1620 STARTTEST |
1621 :set cino=j1,J1 | |
1622 /^JSSTART | |
1623 =/^JSEND | |
1624 ENDTEST | |
1625 | |
1626 JSSTART | |
1627 var foo = [ | |
1628 1, // indent 8 more | |
1629 2, | |
1630 3 | |
1631 ]; // indent 8 less | |
1632 JSEND | |
1633 | |
1634 STARTTEST | |
1635 :set cino=j1,J1 | |
1636 /^JSSTART | |
1637 =/^JSEND | |
1638 ENDTEST | |
1639 | |
1640 JSSTART | |
1641 function bar() { | |
1642 var foo = [ | |
1643 1, | |
1644 2, | |
1645 3 | |
1646 ]; // indent 16 less | |
1647 } | |
1648 JSEND | |
1649 | |
1650 STARTTEST | |
1651 :set cino=j1,J1 | |
1652 /^JSSTART | |
1653 =/^JSEND | |
1654 ENDTEST | |
1655 | |
1656 JSSTART | |
1657 (function($){ | |
1658 | |
1659 var class_name='myclass'; | |
1660 | |
1661 function private_method() { | |
1662 } | |
1663 | |
1664 var public_method={ | |
1665 method: function(options,args){ | |
1666 private_method(); | |
1667 } | |
1668 } | |
1669 | |
1670 function init(options) { | |
1671 | |
1672 $(this).data(class_name+'_public',$.extend({},{ | |
1673 foo: 'bar', | |
1674 bar: 2, // indent 8 more | |
1675 foobar: [ // indent 8 more | |
1676 1, // indent 8 more | |
1677 2, // indent 16 more | |
1678 3 // indent 16 more | |
1679 ], | |
1680 callback: function(){ // indent 8 more | |
1681 return true; // indent 8 more | |
1682 } // indent 8 more | |
1683 }, options||{})); | |
1684 } | |
1685 | |
1686 $.fn[class_name]=function() { | |
1687 | |
1688 var _arguments=arguments; | |
1689 return this.each(function(){ | |
1690 | |
1691 var options=$(this).data(class_name+'_public'); | |
1692 if (!options) { | |
1693 init.apply(this,_arguments); | |
1694 | |
1695 } else { | |
1696 var method=public_method[_arguments[0]]; | |
1697 | |
1698 if (typeof(method)!='function') { | |
1699 console.log(class_name+' has no method "'+_arguments[0]+'"'); | |
1700 return false; | |
1701 } | |
1702 _arguments[0]=options; | |
1703 method.apply(this,_arguments); | |
1704 } | |
1705 }); | |
1706 } | |
1707 | |
1708 })(jQuery); | |
1709 JSEND | |
1710 | |
1711 STARTTEST | |
1712 :set cino=j1,J1 | |
1713 /^JSSTART | |
1714 =/^JSEND | |
1715 ENDTEST | |
1716 | |
1717 JSSTART | |
1718 function init(options) { | |
1719 $(this).data(class_name+'_public',$.extend({},{ | |
1720 foo: 'bar', | |
1721 bar: 2, | |
1722 foobar: [ | |
1723 1, // indent 8 more | |
1724 2, // indent 8 more | |
1725 3 // indent 8 more | |
1726 ], | |
1727 callback: function(){ | |
1728 return true; | |
1729 } | |
1730 }, options||{})); | |
1731 } | |
1732 JSEND | |
1733 | |
1734 STARTTEST | |
1735 :set cino=j1,J1 | |
1736 /^JSSTART | |
1737 =/^JSEND | |
1738 ENDTEST | |
1739 | |
1740 JSSTART | |
1741 (function($){ | |
1742 function init(options) { | |
1743 $(this).data(class_name+'_public',$.extend({},{ | |
1744 foo: 'bar', | |
1745 bar: 2, // indent 8 more | |
1746 foobar: [ // indent 8 more | |
1747 1, // indent 8 more | |
1748 2, // indent 16 more | |
1749 3 // indent 16 more | |
1750 ], | |
1751 callback: function(){ // indent 8 more | |
1752 return true; // indent 8 more | |
1753 } // indent 8 more | |
1754 }, options||{})); | |
1755 } | |
1756 })(jQuery); | |
1757 JSEND | |
1758 | |
1759 STARTTEST | |
1621 :g/^STARTTEST/.,/^ENDTEST/d | 1760 :g/^STARTTEST/.,/^ENDTEST/d |
1622 :1;/start of AUTO/,$wq! test.out | 1761 :1;/start of AUTO/,$wq! test.out |
1623 ENDTEST | 1762 ENDTEST |