mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-17 00:10:03 -04:00
test: check that octal_mode behaves correctly
This commit is contained in:
parent
d3721e8e8e
commit
d0d649e45a
@ -20,6 +20,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <optional>
|
||||||
|
#include <sstream>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
@ -76,6 +78,20 @@ std::ostream& operator<<(std::ostream& os, octal_mode const& mode) {
|
|||||||
|
|
||||||
#define EXPECT_EQ_MODE(a, b) EXPECT_EQ(octal_mode{a}, octal_mode{b})
|
#define EXPECT_EQ_MODE(a, b) EXPECT_EQ(octal_mode{a}, octal_mode{b})
|
||||||
|
|
||||||
|
TEST(chmod_transformer, octal_mode) {
|
||||||
|
std::ostringstream os;
|
||||||
|
os << octal_mode{07777};
|
||||||
|
EXPECT_EQ(os.str(), "07777 UGSrwxrwxrwx");
|
||||||
|
|
||||||
|
os.str("");
|
||||||
|
os << octal_mode{std::nullopt};
|
||||||
|
EXPECT_EQ(os.str(), "std::nullopt");
|
||||||
|
|
||||||
|
os.str("");
|
||||||
|
os << octal_mode{0644};
|
||||||
|
EXPECT_EQ(os.str(), "0644 ---rw-r--r--");
|
||||||
|
}
|
||||||
|
|
||||||
TEST(chmod_transformer, basic) {
|
TEST(chmod_transformer, basic) {
|
||||||
{
|
{
|
||||||
internal::chmod_transformer ct{"u+x", 0022};
|
internal::chmod_transformer ct{"u+x", 0022};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user