3 #include <test/cpp/jit/test_base.h> 4 #include <torch/csrc/jit/script/parser.h> 9 const auto testSource = R
"JIT( 11 def __init__(self, x): 18 void testClassParser() {
19 auto cu = std::make_shared<Module>();
21 std::vector<Def> definitions;
22 std::vector<Resolver> resolvers;
24 const auto classDef = ClassDef(p.parseClass());
25 p.lexer().expect(TK_EOF);
27 ASSERT_EQ(classDef.name().name(),
"FooTest");
28 ASSERT_EQ(classDef.defs().size(), 2);
29 ASSERT_EQ(classDef.defs()[0].name().name(),
"__init__");
30 ASSERT_EQ(classDef.defs()[1].name().name(),
"get_x");