mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-16 07:46:27 -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 <optional>
|
||||
#include <sstream>
|
||||
#include <string_view>
|
||||
|
||||
#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})
|
||||
|
||||
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) {
|
||||
{
|
||||
internal::chmod_transformer ct{"u+x", 0022};
|
||||
|
Loading…
x
Reference in New Issue
Block a user