mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
[hal] Resource classes: Use expected, refactor errors (#8768)
Also revamp SetLastError et al; Instead of taking status by pointer, take by value and return new status instead. Rename from SetLast to Make to make this new usage obvious. Also move declarations for the error functions from duplicated in the per-target HALInternal.hpp to a common ErrorHandling.hpp.
This commit is contained in:
@@ -19,9 +19,9 @@ TEST(HandleTest, ClassedHandle) {
|
||||
wpi::hal::IndexedClassedHandleResource<HAL_TestHandle, MyTestClass, 8,
|
||||
HAL_HandleEnum::VENDOR>
|
||||
testClass;
|
||||
int32_t status = 0;
|
||||
testClass.Allocate(0, std::make_unique<MyTestClass>(), &status);
|
||||
EXPECT_EQ(0, status);
|
||||
auto resource =
|
||||
testClass.Allocate(0, std::make_shared<MyTestClass>(), "TestResource");
|
||||
EXPECT_TRUE(resource.has_value());
|
||||
}
|
||||
|
||||
} // namespace wpi::hal
|
||||
|
||||
Reference in New Issue
Block a user