test/jdk/java/util/Formatter/BasicChar.java

Print this page




1775 
1776 
1777         //---------------------------------------------------------------------
1778         // %n
1779         //---------------------------------------------------------------------
1780         test("%n", System.getProperty("line.separator"), (Object)null);
1781         test("%n", System.getProperty("line.separator"), "");
1782 
1783         tryCatch("%,n", IllegalFormatFlagsException.class);
1784         tryCatch("%.n", UnknownFormatConversionException.class);
1785         tryCatch("%5.n", UnknownFormatConversionException.class);
1786         tryCatch("%5n", IllegalFormatWidthException.class);
1787         tryCatch("%.7n", IllegalFormatPrecisionException.class);
1788         tryCatch("%<n", IllegalFormatFlagsException.class);
1789 
1790         //---------------------------------------------------------------------
1791         // %%
1792         //---------------------------------------------------------------------
1793         test("%%", "%", (Object)null);
1794         test("%%", "%", "");









1795         tryCatch("%%%", UnknownFormatConversionException.class);
1796         // perhaps an IllegalFormatArgumentIndexException should be defined?
1797         tryCatch("%<%", IllegalFormatFlagsException.class);
1798     }
1799 }


1775 
1776 
1777         //---------------------------------------------------------------------
1778         // %n
1779         //---------------------------------------------------------------------
1780         test("%n", System.getProperty("line.separator"), (Object)null);
1781         test("%n", System.getProperty("line.separator"), "");
1782 
1783         tryCatch("%,n", IllegalFormatFlagsException.class);
1784         tryCatch("%.n", UnknownFormatConversionException.class);
1785         tryCatch("%5.n", UnknownFormatConversionException.class);
1786         tryCatch("%5n", IllegalFormatWidthException.class);
1787         tryCatch("%.7n", IllegalFormatPrecisionException.class);
1788         tryCatch("%<n", IllegalFormatFlagsException.class);
1789 
1790         //---------------------------------------------------------------------
1791         // %%
1792         //---------------------------------------------------------------------
1793         test("%%", "%", (Object)null);
1794         test("%%", "%", "");
1795 
1796         test("%5%", "    %", (Object)null);
1797         test("%5%", "    %", "");
1798         test("%-5%", "%    ", (Object)null);
1799         test("%-5%", "%    ", "");
1800 
1801         tryCatch("%.5%", IllegalFormatPrecisionException.class);
1802         tryCatch("%5.5%", IllegalFormatPrecisionException.class);
1803 
1804         tryCatch("%%%", UnknownFormatConversionException.class);
1805         // perhaps an IllegalFormatArgumentIndexException should be defined?
1806         tryCatch("%<%", IllegalFormatFlagsException.class);
1807     }
1808 }