diff options
| author | 2017-01-14 19:55:43 +0000 | |
|---|---|---|
| committer | 2017-01-14 19:55:43 +0000 | |
| commit | bd3306aecb3a15e8967143b8cdbbccf2b1b19b74 (patch) | |
| tree | 309a8132b44564b9e634c0da6815187ce8eab27c /gnu/llvm/unittests/ObjectYAML | |
| parent | killp -a should not kill the window if only one pane. (diff) | |
| download | wireguard-openbsd-bd3306aecb3a15e8967143b8cdbbccf2b1b19b74.tar.xz wireguard-openbsd-bd3306aecb3a15e8967143b8cdbbccf2b1b19b74.zip | |
Import LLVM 3.9.1 including clang and lld.
Diffstat (limited to 'gnu/llvm/unittests/ObjectYAML')
| -rw-r--r-- | gnu/llvm/unittests/ObjectYAML/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | gnu/llvm/unittests/ObjectYAML/YAMLTest.cpp | 38 |
2 files changed, 46 insertions, 0 deletions
diff --git a/gnu/llvm/unittests/ObjectYAML/CMakeLists.txt b/gnu/llvm/unittests/ObjectYAML/CMakeLists.txt new file mode 100644 index 00000000000..baed10b8730 --- /dev/null +++ b/gnu/llvm/unittests/ObjectYAML/CMakeLists.txt @@ -0,0 +1,8 @@ +set(LLVM_LINK_COMPONENTS + ObjectYAML + ) + +add_llvm_unittest(ObjectYAMLTests + YAMLTest.cpp + ) + diff --git a/gnu/llvm/unittests/ObjectYAML/YAMLTest.cpp b/gnu/llvm/unittests/ObjectYAML/YAMLTest.cpp new file mode 100644 index 00000000000..606e160d19a --- /dev/null +++ b/gnu/llvm/unittests/ObjectYAML/YAMLTest.cpp @@ -0,0 +1,38 @@ +//===- YAMLTest.cpp - Tests for Object YAML -------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/ObjectYAML/YAML.h" +#include "llvm/Support/YAMLTraits.h" +#include "gtest/gtest.h" + +using namespace llvm; + +struct BinaryHolder { + yaml::BinaryRef Binary; +}; + +namespace llvm { +namespace yaml { +template <> +struct MappingTraits<BinaryHolder> { + static void mapping(IO &IO, BinaryHolder &BH) { + IO.mapRequired("Binary", BH.Binary); + } +}; +} // end namespace yaml +} // end namespace llvm + +TEST(ObjectYAML, BinaryRef) { + BinaryHolder BH; + SmallVector<char, 32> Buf; + llvm::raw_svector_ostream OS(Buf); + yaml::Output YOut(OS); + YOut << BH; + EXPECT_NE(OS.str().find("''"), StringRef::npos); +} |
