2015-04-14 15:00:34 +00:00
|
|
|
//===- raw_pwrite_stream_test.cpp - raw_pwrite_stream tests ---------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
#include "llvm/ADT/SmallString.h"
|
|
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
TEST(raw_pwrite_ostreamTest, TestSVector) {
|
2015-04-20 13:04:30 +00:00
|
|
|
SmallVector<char, 0> Buffer;
|
2015-04-14 15:00:34 +00:00
|
|
|
raw_svector_ostream OS(Buffer);
|
2015-04-20 13:04:30 +00:00
|
|
|
OS << "abcd";
|
2015-04-14 15:00:34 +00:00
|
|
|
StringRef Test = "test";
|
|
|
|
OS.pwrite(Test.data(), Test.size(), 0);
|
|
|
|
EXPECT_EQ(Test, OS.str());
|
2015-04-20 13:04:30 +00:00
|
|
|
|
|
|
|
#ifdef GTEST_HAS_DEATH_TEST
|
|
|
|
#ifndef NDEBUG
|
|
|
|
EXPECT_DEATH(OS.pwrite("12345", 5, 0),
|
|
|
|
"We don't support extending the stream");
|
|
|
|
#endif
|
|
|
|
#endif
|
2015-04-14 15:00:34 +00:00
|
|
|
}
|
|
|
|
}
|