Checks the given |error_message| is reported when trying to build a module from the given |assembly|.
| 1397 | // Checks the given |error_message| is reported when trying to build a module |
| 1398 | // from the given |assembly|. |
| 1399 | void DoErrorMessageCheck(const std::string& assembly, |
| 1400 | const std::string& error_message, uint32_t line_num) { |
| 1401 | auto consumer = [error_message, line_num](spv_message_level_t, const char*, |
| 1402 | const spv_position_t& position, |
| 1403 | const char* m) { |
| 1404 | EXPECT_EQ(error_message, m); |
| 1405 | EXPECT_EQ(line_num, position.line); |
| 1406 | }; |
| 1407 | |
| 1408 | SpirvTools t(SPV_ENV_UNIVERSAL_1_1); |
| 1409 | std::unique_ptr<IRContext> context = |
| 1410 | BuildModule(SPV_ENV_UNIVERSAL_1_1, std::move(consumer), assembly); |
| 1411 | EXPECT_EQ(nullptr, context); |
| 1412 | } |
| 1413 | |
| 1414 | TEST(IrBuilder, FunctionInsideFunction) { |
| 1415 | DoErrorMessageCheck("%2 = OpFunction %1 None %3\n%5 = OpFunction %4 None %6", |