test: reorganize C++/C#/Go test suites into per-feature files (load/get/ordered_map/index)#166
Conversation
Reorganize the C++, C# and Go test suites into per-feature files (load/get/ordered_map/index), extract shared setup (C++ hub_fixture.h), and refresh the generated protoconf loader sources accordingly.
Code Review findings (10 items, ranked by severity)See full details in the separate review comment. Summary: Red (correctness/CI)
Yellow (coverage/release) Green (minor) |
Details for Finding 1 — make.py:974 GITHUB_PATH skipRoot cause: _prepend_path early-returns when the dir is already in os.environ['PATH'], before the GITHUB_PATH append at line 979. ubuntu-latest runners have ~/.local/bin on PATH by default, so the persistence block is never reached when buf is installed there. The next workflow step's fresh shell (rebuilt from GITHUB_PATH) loses buf. Fix: move the GITHUB_PATH write above the membership check, so it fires unconditionally regardless of in-process PATH state. |
Details for Finding 2 — ModeOnlyPatch assertions too weak (all 3 languages)conf/PatchMergeConf.json sets name='apple'; patchconf/PatchMergeConf.json sets name='orange'. The tests assert only that name is non-empty, which passes whether ModeOnlyPatch works correctly (yields 'orange') or is silently a no-op (yields 'orange' from main+patch merge, or 'apple' from main-only — both non-empty). Fix: assert name equals 'orange' specifically. This proves the patch value was applied AND the main file's value was not the source. |
Details for Finding 3 — lost Hub::GetOrderedMap<Mgr,T>(leveled-keys) coverage in C++The deleted hub_test.cpp contained:
The new ordered_map_test.cpp only calls conf->GetOrderedMap() (no-arg messager method) and walks deeper via iterator — the Hub API's multi-key template overload is never invoked anywhere in the test suite. Grep across test/cpp-tableau-loader/tests/ confirms zero remaining calls to Hub::Instance().GetOrderedMap with arguments. Fix: add a test to ordered_map_test.cpp that calls the 1-key overload (chapter sub-map) and the 3-key overload (rank map), asserting each is non-null. |
Details for Findings 4–10 (yellow/green)Finding 4 — csharp version not bumped (cmd/protoc-gen-csharp-tableau-loader/main.go:13) Finding 5 — IndexTests.cs missing FindFirstAwardItem Finding 6 — BUF_VERSION dead in workflow env Finding 7 — 2nd-level sub-map non-empty assertion dropped Finding 8 — redundant 'first' flag in ordered-map tests (3 languages) Finding 9 — FruitType constants duplicated in C# Finding 10 — LoadTests.cs:PatchConf2_DifferentFormat_PatchPathsOverride misleading name |
- make.py: persist GITHUB_PATH even when dir already on in-process PATH, so tools installed by 'make.py setup' are visible to later GHA steps - ModeOnlyPatch: assert concrete name="orange" instead of just non-empty (cpp/csharp/go) - cpp ordered_map_test: restore leveled-keys GetOrderedMap coverage (1-key chapter map, 3-key rank map) - csharp IndexTests: add FindFirstAwardItem assertion to mirror cpp - cpp/csharp ordered_map: assert 2nd-level sub-map is non-empty - cpp/csharp/go: drop redundant 'first' guard in ascending-key check (prev=0 already handles iteration 1) - csharp: centralize FruitType constants into HubFixture.FruitTypes, mirroring cpp (hub_fixture.h) and go (index_test.go) - csharp LoadTests: rename misleading test to PatchConf2_PatchPathsOverride_UsesJson and clarify comment
Summary
Reorganizes the C++, C# and Go test suites from a few monolithic files into
focused, per-feature test files, mirroring the four functional areas of the
tableau loader: Load → Get → OrderedMap → Index. This brings the three
native-language suites in line with the structure already adopted for TS.
What changed
C++ (GoogleTest)
hub_test.cpp/patch_test.cppinto:load_test.cpp,get_test.cpp,ordered_map_test.cpp,index_test.cppHubFixtureinto a new headertests/hub_fixture.hso every test file reuses one initialized
Hubinstead of duplicating setup.test_paths.h: minor path addition to support the new files.C# (xUnit)
ActivityConfTests.cs/BinTests.cs/HubTests.cs/PatchTests.cswith feature-grouped files:
LoadTests.cs,GetTests.cs,OrderedMapTests.cs,IndexTests.cs(sharedHubFixture/HubCollectionretained).Go
main_test.gointoload_test.go,get_test.go,ordered_map_test.goand reworked
index_test.go; shared setup via theprepareHub(t)helper.Generated sources
protoconfloader sources (C++*.pc.cc/.pc.h,Go
*.pc.go) — header/comment-level regeneration only, no behavioral change.Verification
make.py testpasses for all three languages via the fullcodegen → build → test pipeline:
ctestdotnet testgo test -race ./...Notes
is touched.
patch_test.cpp → load_test.cpp,PatchTests.cs → LoadTests.cs,main_test.go → load_test.go) to preserve history.