Fix error attribute naming for Linux 5.0

There was a slight change to one of the error attributes as part of the
OCC driver upstreaming process. This commit also adds unit tests for the
error attributes. This required some refactoring to support the unit
tests.

Resolves openbmc/openbmc#3505

Signed-off-by: Eddie James <eajames@us.ibm.com>
Change-Id: I665b46e44b18befc8a728f7246bcda82f1f1a71c
diff --git a/test/utest.cpp b/test/utest.cpp
index eb9ca0b..39e5250 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -1,5 +1,6 @@
 #include "powercap.hpp"
 
+#include <experimental/filesystem>
 #include <occ_events.hpp>
 #include <occ_manager.hpp>
 
@@ -43,3 +44,27 @@
     uint32_t occInput = pcap.getOccInput(100, true);
     EXPECT_EQ(occInput, 90);
 }
+
+TEST(VerifyPathParsing, EmptyPath)
+{
+    std::experimental::filesystem::path path = "";
+    std::string parsed = Device::getPathBack(path);
+
+    EXPECT_STREQ(parsed.c_str(), "");
+}
+
+TEST(VerifyPathParsing, FilenamePath)
+{
+    std::experimental::filesystem::path path = "/test/foo.bar";
+    std::string parsed = Device::getPathBack(path);
+
+    EXPECT_STREQ(parsed.c_str(), "foo.bar");
+}
+
+TEST(VerifyPathParsing, DirectoryPath)
+{
+    std::experimental::filesystem::path path = "/test/bar/";
+    std::string parsed = Device::getPathBack(path);
+
+    EXPECT_STREQ(parsed.c_str(), "bar");
+}