diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-14 15:00:34 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-14 15:00:34 +0000 |
commit | 37b7015916f8bad7defd8011a94b98e430d8afa7 (patch) | |
tree | 06333a936e416d92e1b1df2e4d60a6dfdc7d4990 /llvm/unittests | |
parent | 7b1059bb2d1cac3c41d69a5fde5a412b02f2d0ff (diff) | |
download | bcm5719-llvm-37b7015916f8bad7defd8011a94b98e430d8afa7.tar.gz bcm5719-llvm-37b7015916f8bad7defd8011a94b98e430d8afa7.zip |
Add raw_pwrite_stream type.
This is a raw_ostream that also supports pwrite.
I will be used in a sec.
llvm-svn: 234895
Diffstat (limited to 'llvm/unittests')
-rw-r--r-- | llvm/unittests/Support/CMakeLists.txt | 1 | ||||
-rw-r--r-- | llvm/unittests/Support/raw_pwrite_stream_test.cpp | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/llvm/unittests/Support/CMakeLists.txt b/llvm/unittests/Support/CMakeLists.txt index f3b55c3a417..3c8a090c2ba 100644 --- a/llvm/unittests/Support/CMakeLists.txt +++ b/llvm/unittests/Support/CMakeLists.txt @@ -44,6 +44,7 @@ add_llvm_unittest(SupportTests YAMLParserTest.cpp formatted_raw_ostream_test.cpp raw_ostream_test.cpp + raw_pwrite_stream_test.cpp ) # ManagedStatic.cpp uses <pthread>. diff --git a/llvm/unittests/Support/raw_pwrite_stream_test.cpp b/llvm/unittests/Support/raw_pwrite_stream_test.cpp new file mode 100644 index 00000000000..bcbb29b86bd --- /dev/null +++ b/llvm/unittests/Support/raw_pwrite_stream_test.cpp @@ -0,0 +1,25 @@ +//===- 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) { + SmallString<64> Buffer; + raw_svector_ostream OS(Buffer); + StringRef Test = "test"; + OS.pwrite(Test.data(), Test.size(), 0); + EXPECT_EQ(Test, OS.str()); +} +} |