37 public static void main(String... args) { |
37 public static void main(String... args) { |
38 new T6868539().run(); |
38 new T6868539().run(); |
39 } |
39 } |
40 |
40 |
41 void run() { |
41 void run() { |
42 verify("T6868539", "Utf8 +java/lang/String"); // 1: Utf8 |
42 String output = javap("T6868539"); |
|
43 verify(output, "Utf8 +java/lang/String"); // 1: Utf8 |
43 // 2: currently unused |
44 // 2: currently unused |
44 verify("T6868539", "Integer +123456"); // 3: Integer |
45 verify(output, "Integer +123456"); // 3: Integer |
45 verify("T6868539", "Float +123456.0f"); // 4: Float |
46 verify(output, "Float +123456.0f"); // 4: Float |
46 verify("T6868539", "Long +123456l"); // 5: Long |
47 verify(output, "Long +123456l"); // 5: Long |
47 verify("T6868539", "Double +123456.0d"); // 6: Double |
48 verify(output, "Double +123456.0d"); // 6: Double |
48 verify("T6868539", "Class +#[0-9]+ +// + T6868539"); // 7: Class |
49 verify(output, "Class +#[0-9]+ +// + T6868539"); // 7: Class |
49 verify("T6868539", "String +#[0-9]+ +// + not found"); // 8: String |
50 verify(output, "String +#[0-9]+ +// + not found"); // 8: String |
50 verify("T6868539", "Fieldref +#[0-9]+\\.#[0-9]+ +// +T6868539.errors:I"); // 9: Fieldref |
51 verify(output, "Fieldref +#[0-9]+\\.#[0-9]+ +// +T6868539.errors:I"); // 9: Fieldref |
51 verify("T6868539", "Methodref +#[0-9]+\\.#[0-9]+ +// +T6868539.run:\\(\\)V"); // 10: Methodref |
52 verify(output, "Methodref +#[0-9]+\\.#[0-9]+ +// +T6868539.run:\\(\\)V"); // 10: Methodref |
52 verify("T6868539", "InterfaceMethodref +#[0-9]+\\.#[0-9]+ +// +java/lang/Runnable\\.run:\\(\\)V"); |
53 verify(output, "InterfaceMethodref +#[0-9]+\\.#[0-9]+ +// +java/lang/Runnable\\.run:\\(\\)V"); |
53 // 11: InterfaceMethodref |
54 // 11: InterfaceMethodref |
54 verify("T6868539", "NameAndType +#[0-9]+:#[0-9]+ +// +run:\\(\\)V"); // 12: NameAndType |
55 verify(output, "NameAndType +#[0-9]+:#[0-9]+ +// +run:\\(\\)V"); // 12: NameAndType |
55 if (errors > 0) |
56 if (errors > 0) |
56 throw new Error(errors + " found."); |
57 throw new Error(errors + " found."); |
57 } |
58 } |
58 |
59 |
59 void verify(String className, String... expects) { |
60 void verify(String output, String... expects) { |
60 String output = javap(className); |
|
61 for (String expect: expects) { |
61 for (String expect: expects) { |
62 if (!output.matches("(?s).*" + expect + ".*")) |
62 if (!output.matches("(?s).*" + expect + ".*")) |
63 error(expect + " not found"); |
63 error(expect + " not found"); |
64 } |
64 } |
65 } |
65 } |