sapling/eden/fs/testharness/TestChecks.h
Andres Suarez fbdb46f5cb Tidy up license headers
Reviewed By: chadaustin

Differential Revision: D17872966

fbshipit-source-id: cd60a364a2146f0dadbeca693b1d4a5d7c97ff63
2019-10-11 05:28:23 -07:00

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)