use of net.morimekta.providence.model.ProgramType in project providence by morimekta.
the class ThriftProgramParserTest method testAutoId.
@Test
public void testAutoId() throws IOException {
copyResourceTo("/parser/tests/autoid.thrift", tmp.getRoot());
File autoid = new File(tmp.getRoot(), "autoid.thrift");
ThriftProgramParser parser = new ThriftProgramParser();
ProgramType program = parser.parse(new FileInputStream(autoid), autoid, new TreeSet<>());
assertEquals("{\n" + " program_name = \"autoid\"\n" + " namespaces = {\n" + " \"java\": \"net.morimekta.test.autoid\"\n" + " }\n" + " decl = [\n" + " {\n" + " decl_struct = {\n" + " variant = EXCEPTION\n" + " name = \"AutoId\"\n" + " fields = [\n" + " {\n" + " id = -1\n" + " type = \"string\"\n" + " name = \"message\"\n" + " },\n" + " {\n" + " id = -2\n" + " type = \"i32\"\n" + " name = \"second\"\n" + " }\n" + " ]\n" + " }\n" + " },\n" + " {\n" + " decl_service = {\n" + " name = \"AutoParam\"\n" + " methods = [\n" + " {\n" + " return_type = \"i32\"\n" + " name = \"method\"\n" + " params = [\n" + " {\n" + " id = -1\n" + " type = \"i32\"\n" + " name = \"a\"\n" + " },\n" + " {\n" + " id = -2\n" + " type = \"i32\"\n" + " name = \"b\"\n" + " }\n" + " ]\n" + " exceptions = [\n" + " {\n" + " id = -1\n" + " type = \"AutoId\"\n" + " name = \"auto1\"\n" + " }\n" + " ]\n" + " }\n" + " ]\n" + " }\n" + " }\n" + " ]\n" + "}", debugString(program));
}
Aggregations