File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -363,10 +363,13 @@ widget = "1.0.0"
363363 auto injected = mcpp::scaffold::inject_self_dependency (
364364 manifest, vars, {" gui" });
365365 ASSERT_TRUE (injected.has_value ()) << injected.error ();
366- std::ifstream is (manifest);
367- std::stringstream ss;
368- ss << is.rdbuf ();
369- auto text = ss.str ();
366+ std::string text;
367+ {
368+ std::ifstream is (manifest);
369+ std::stringstream ss;
370+ ss << is.rdbuf ();
371+ text = ss.str ();
372+ }
370373 EXPECT_NE (text.find (" [dependencies.acme]\n widget = { version = \" 2.0.0\" , features = [\" gui\" ] }" ),
371374 std::string::npos);
372375 EXPECT_NE (text.find (" [dependencies.compat]\n widget = \" 1.0.0\" " ),
@@ -375,10 +378,12 @@ widget = "1.0.0"
375378 auto again = mcpp::scaffold::inject_self_dependency (
376379 manifest, vars, {" gui" });
377380 ASSERT_TRUE (again.has_value ()) << again.error ();
378- std::ifstream is2 (manifest);
379- std::stringstream ss2;
380- ss2 << is2.rdbuf ();
381- EXPECT_EQ (ss2.str (), text);
381+ {
382+ std::ifstream is (manifest);
383+ std::stringstream ss;
384+ ss << is.rdbuf ();
385+ EXPECT_EQ (ss.str (), text);
386+ }
382387 std::filesystem::remove_all (root);
383388}
384389
You can’t perform that action at this time.
0 commit comments