mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
fbdb46f5cb
Reviewed By: chadaustin Differential Revision: D17872966 fbshipit-source-id: cd60a364a2146f0dadbeca693b1d4a5d7c97ff63
31 lines
1.2 KiB
C++
31 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This software may be used and distributed according to the terms of the
|
|
* GNU General Public License version 2.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <folly/Format.h>
|
|
#include <folly/Range.h>
|
|
#include <folly/io/IOBuf.h>
|
|
#include <gtest/gtest.h>
|
|
#include "eden/fs/inodes/FileInode.h"
|
|
|
|
/**
|
|
* Check that a FileInode has the expected contents and permissions.
|
|
*/
|
|
#define EXPECT_FILE_INODE(fileInode, expectedData, expectedPerms) \
|
|
do { \
|
|
EXPECT_EQ( \
|
|
expectedData, \
|
|
folly::StringPiece{ \
|
|
(fileInode)->readAll().get(std::chrono::seconds(20))}) \
|
|
<< " for inode path " << (fileInode)->getLogPath(); \
|
|
EXPECT_EQ( \
|
|
folly::sformat("{:#o}", (expectedPerms)), \
|
|
folly::sformat("{:#o}", (fileInode)->getPermissions())) \
|
|
<< " for inode path " << (fileInode)->getLogPath(); \
|
|
} while (0)
|