| 216 | }); |
| 217 | |
| 218 | TEST_F(GraphConstructorTest, InvalidNodeName) { |
| 219 | auto expect_invalid_name = [this](const char* name) { |
| 220 | ExpectError(strings::StrCat("node { name: '", name, "' op: 'ABC' }"), |
| 221 | {"Node name contains invalid characters"}); |
| 222 | }; |
| 223 | |
| 224 | expect_invalid_name("a:b"); |
| 225 | expect_invalid_name("_abc"); // Can't start with '_' |
| 226 | // Name is a\b, but proto text format escapes slashes so we use a\\b here. |
| 227 | expect_invalid_name(R"(a\\b)"); |
| 228 | expect_invalid_name("/a"); |
| 229 | expect_invalid_name("-a"); |
| 230 | |
| 231 | ExpectOK("node { name: 'a-bc_' op: 'ABC' }"); |
| 232 | ExpectOK("node { name: 'a-B.0/.c_' op: 'ABC' }"); |
| 233 | ExpectOK("node { name: '0123' op: 'ABC' }"); |
| 234 | ExpectOK("node { name: '.0123' op: 'ABC' }"); |
| 235 | } |
| 236 | |
| 237 | TEST_F(GraphConstructorTest, InvalidSourceNodeName) { |
| 238 | ExpectError( |
nothing calls this directly
no test coverage detected