Assumes that the syntax changes after performing the given action on the named particle Optionally calls the given predicate with the syntax after the change
| 420 | // Assumes that the syntax changes after performing the given action on the named particle |
| 421 | // Optionally calls the given predicate with the syntax after the change |
| 422 | inline void expectSyntaxChangeAfter(const std::string& defName, |
| 423 | std::function<void(const particles::IParticleDef::Ptr&)> action, |
| 424 | std::function<void(const std::string&)> predicate = [](const std::string&) { }) |
| 425 | { |
| 426 | auto decl = GlobalParticlesManager().getDefByName(defName); |
| 427 | auto blockSyntaxBeforeChange = decl->getBlockSyntax().contents; |
| 428 | |
| 429 | action(decl); |
| 430 | |
| 431 | // Block syntax should have changed by now |
| 432 | auto blockSyntaxAfterChange = decl->getBlockSyntax().contents; |
| 433 | |
| 434 | EXPECT_NE(blockSyntaxBeforeChange, blockSyntaxAfterChange) << "Syntax block should have changed"; |
| 435 | |
| 436 | predicate(blockSyntaxAfterChange); |
| 437 | } |
| 438 | |
| 439 | TEST_F(ParticlesTest, SyntaxChangeAddStage) |
| 440 | { |