MCPcopy Index your code
hub / github.com/Palmr/classfile-parser / test_class

Function test_class

tests/code_attribute.rs:67–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65
66#[test]
67fn test_class() {
68 let class_bytes = include_bytes!("../java-assets/compiled-classes/Instructions.class");
69 let (_, class) = class_parser(class_bytes).unwrap();
70 let method_info = &class
71 .methods
72 .iter()
73 .find(|m| m.access_flags.contains(MethodAccessFlags::STATIC))
74 .unwrap();
75 let (_, code_attribute) = code_attribute_parser(&method_info.attributes[0].info).unwrap();
76
77 let parsed = code_parser(&code_attribute.code);
78
79 assert!(parsed.is_ok());
80 assert_eq!(64, parsed.unwrap().1.len());
81}
82
83fn lookup_string(c: &classfile_parser::ClassFile, index: u16) -> Option<String> {
84 let con = &c.const_pool[(index - 1) as usize];

Callers

nothing calls this directly

Calls 3

class_parserFunction · 0.85
code_attribute_parserFunction · 0.85
code_parserFunction · 0.85

Tested by

no test coverage detected