| 24 | namespace { |
| 25 | |
| 26 | TEST(UpdateApiDefTest, TestRemoveDocSingleOp) { |
| 27 | const string op_def_text = R"opdef( |
| 28 | REGISTER_OP("Op1") |
| 29 | .Input("a: T") |
| 30 | .Output("output: T") |
| 31 | .Attr("b: type") |
| 32 | .SetShapeFn(shape_inference::UnchangedShape); |
| 33 | )opdef"; |
| 34 | |
| 35 | const string op_def_text_with_doc = R"opdef( |
| 36 | REGISTER_OP("Op1") |
| 37 | .Input("a: T") |
| 38 | .Output("output: T") |
| 39 | .Attr("b: type") |
| 40 | .SetShapeFn(shape_inference::UnchangedShape) |
| 41 | .Doc(R"doc( |
| 42 | Summary for Op1. |
| 43 | |
| 44 | Description |
| 45 | for Op1. |
| 46 | |
| 47 | b : Description for b. |
| 48 | a: Description for a. |
| 49 | output: Description for output. |
| 50 | )doc"); |
| 51 | )opdef"; |
| 52 | |
| 53 | const string op_text = R"( |
| 54 | name: "Op1" |
| 55 | input_arg { |
| 56 | name: "a" |
| 57 | description: "Description for a." |
| 58 | } |
| 59 | output_arg { |
| 60 | name: "output" |
| 61 | description: "Description for output." |
| 62 | } |
| 63 | attr { |
| 64 | name: "b" |
| 65 | description: "Description for b." |
| 66 | } |
| 67 | summary: "Summary for Op1." |
| 68 | description: "Description\nfor Op1." |
| 69 | )"; |
| 70 | OpDef op; |
| 71 | protobuf::TextFormat::ParseFromString(op_text, &op); // NOLINT |
| 72 | |
| 73 | EXPECT_EQ(op_def_text, |
| 74 | RemoveDoc(op, op_def_text_with_doc, 0 /* start_location */)); |
| 75 | } |
| 76 | |
| 77 | TEST(UpdateApiDefTest, TestRemoveDocMultipleOps) { |
| 78 | const string op_def_text = R"opdef( |
nothing calls this directly
no test coverage detected