From 550cbec5c4dcf785d382950e2651a423f55b2f6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 25 Oct 2021 12:35:21 +0200 Subject: Cleanup: asset catalog path test, improve sub-test separation Put related lines in a block of their own, such that each block doesn't have access to the variables of the previous blocks. This makes it easier to correctly copy-paste some tests, as the compiler forces you to update the code afterwards. --- .../blenkernel/intern/asset_catalog_path_test.cc | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/asset_catalog_path_test.cc b/source/blender/blenkernel/intern/asset_catalog_path_test.cc index be50f2fc001..997f57a161c 100644 --- a/source/blender/blenkernel/intern/asset_catalog_path_test.cc +++ b/source/blender/blenkernel/intern/asset_catalog_path_test.cc @@ -193,19 +193,21 @@ TEST(AssetCatalogPathTest, is_contained_in) TEST(AssetCatalogPathTest, cleanup) { - AssetCatalogPath ugly_path("/ some / родитель / "); - AssetCatalogPath clean_path = ugly_path.cleanup(); - - EXPECT_EQ(AssetCatalogPath("/ some / родитель / "), ugly_path) - << "cleanup should not modify the path instance itself"; - - EXPECT_EQ(AssetCatalogPath("some/родитель"), clean_path); - - AssetCatalogPath double_slashed("some//родитель"); - EXPECT_EQ(AssetCatalogPath("some/родитель"), double_slashed.cleanup()); - - AssetCatalogPath with_colons("some/key:subkey=value/path"); - EXPECT_EQ(AssetCatalogPath("some/key-subkey=value/path"), with_colons.cleanup()); + { + AssetCatalogPath ugly_path("/ some / родитель / "); + AssetCatalogPath clean_path = ugly_path.cleanup(); + EXPECT_EQ(AssetCatalogPath("/ some / родитель / "), ugly_path) + << "cleanup should not modify the path instance itself"; + EXPECT_EQ(AssetCatalogPath("some/родитель"), clean_path); + } + { + AssetCatalogPath double_slashed("some//родитель"); + EXPECT_EQ(AssetCatalogPath("some/родитель"), double_slashed.cleanup()); + } + { + AssetCatalogPath with_colons("some/key:subkey=value/path"); + EXPECT_EQ(AssetCatalogPath("some/key-subkey=value/path"), with_colons.cleanup()); + } } TEST(AssetCatalogPathTest, iterate_components) -- cgit v1.2.3