mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
13dc5d1d51
Summary: Also print the inode path if the assertions in EXPECT_FILE_INODE fail. Reviewed By: simpkins Differential Revision: D7035517 fbshipit-source-id: 6c50acb588d1c985c7e7a1586c06f04a657698f9
33 lines
1.3 KiB
C++
33 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2004-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
*/
|
|
#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)
|