mirror of
https://github.com/Kistler-Group/sdbus-cpp.git
synced 2025-10-01 08:10:55 +02:00
Allow ObjectPath and Signature be created from std::string
This commit is contained in:
@@ -140,6 +140,9 @@ namespace sdbus {
|
||||
public:
|
||||
using std::string::string;
|
||||
using std::string::operator=;
|
||||
ObjectPath(std::string path)
|
||||
: std::string(std::move(path))
|
||||
{}
|
||||
};
|
||||
|
||||
class Signature : public std::string
|
||||
@@ -147,6 +150,9 @@ namespace sdbus {
|
||||
public:
|
||||
using std::string::string;
|
||||
using std::string::operator=;
|
||||
Signature(std::string path)
|
||||
: std::string(std::move(path))
|
||||
{}
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -212,3 +212,31 @@ TEST(AStruct, CreatesStructFromTuple)
|
||||
ASSERT_THAT(std::get<0>(valueStruct), Eq(std::get<0>(value)));
|
||||
ASSERT_THAT(std::get<1>(valueStruct), Eq(std::get<1>(value)));
|
||||
}
|
||||
|
||||
TEST(AnObjectPath, CanBeConstructedFromCString)
|
||||
{
|
||||
const char* aPath = "/some/path";
|
||||
|
||||
ASSERT_THAT(sdbus::ObjectPath{aPath}, Eq(aPath));
|
||||
}
|
||||
|
||||
TEST(AnObjectPath, CanBeConstructedFromStdString)
|
||||
{
|
||||
std::string aPath{"/some/path"};
|
||||
|
||||
ASSERT_THAT(sdbus::ObjectPath{aPath}, Eq(aPath));
|
||||
}
|
||||
|
||||
TEST(ASignature, CanBeConstructedFromCString)
|
||||
{
|
||||
const char* aSignature = "us";
|
||||
|
||||
ASSERT_THAT(sdbus::Signature{aSignature}, Eq(aSignature));
|
||||
}
|
||||
|
||||
TEST(ASignature, CanBeConstructedFromStdString)
|
||||
{
|
||||
std::string aSignature{"us"};
|
||||
|
||||
ASSERT_THAT(sdbus::Signature{aSignature}, Eq(aSignature));
|
||||
}
|
||||
|
Reference in New Issue
Block a user