Fixes and improvements (#617)
This commit is contained in:
committed by
GitHub
parent
b03759a111
commit
0ff1627385
@@ -9,7 +9,7 @@ extern "C" {
|
||||
|
||||
error_t service_paths_get_user_data_directory(const char* service_id, char* out_path, size_t out_path_size) {
|
||||
char root[192];
|
||||
error_t error = paths_get_user_data_path(root, sizeof(root));
|
||||
error_t error = paths_get_data_path(root, sizeof(root));
|
||||
if (error != ERROR_NONE) {
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -7,20 +7,20 @@
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
TEST_CASE("paths_get_user_data_path returns a non-empty path") {
|
||||
TEST_CASE("paths_get_data_path returns a non-empty path") {
|
||||
char buffer[192];
|
||||
CHECK_EQ(paths_get_user_data_path(buffer, sizeof(buffer)), ERROR_NONE);
|
||||
REQUIRE_EQ(paths_get_data_path(buffer, sizeof(buffer)), ERROR_NONE);
|
||||
CHECK_GT(std::strlen(buffer), 0);
|
||||
}
|
||||
|
||||
TEST_CASE("paths_get_user_data_path reports overflow for a too-small buffer") {
|
||||
TEST_CASE("paths_get_data_path reports overflow for a too-small buffer") {
|
||||
char buffer[1];
|
||||
CHECK_EQ(paths_get_user_data_path(buffer, sizeof(buffer)), ERROR_BUFFER_OVERFLOW);
|
||||
CHECK_EQ(paths_get_data_path(buffer, sizeof(buffer)), ERROR_BUFFER_OVERFLOW);
|
||||
}
|
||||
|
||||
TEST_CASE("service_paths_get_user_data_directory includes the service id") {
|
||||
char root[192];
|
||||
REQUIRE_EQ(paths_get_user_data_path(root, sizeof(root)), ERROR_NONE);
|
||||
REQUIRE_EQ(paths_get_data_path(root, sizeof(root)), ERROR_NONE);
|
||||
|
||||
char buffer[224];
|
||||
CHECK_EQ(service_paths_get_user_data_directory("my-service", buffer, sizeof(buffer)), ERROR_NONE);
|
||||
|
||||
Reference in New Issue
Block a user