diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-03-01 19:15:06 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-03-01 19:15:06 +0000 |
| commit | ebd9193b57750faabaeed0f28acc23fb38d1d06b (patch) | |
| tree | c062fc745b317b2eab4a37aa543ea4ac0c5dc649 /llvm/unittests/ObjectYAML/YAMLTest.cpp | |
| parent | 8a37a988e6644403dc6f0c297d2d653fed3ebdc3 (diff) | |
| download | llvm-ebd9193b57750faabaeed0f28acc23fb38d1d06b.zip llvm-ebd9193b57750faabaeed0f28acc23fb38d1d06b.tar.gz llvm-ebd9193b57750faabaeed0f28acc23fb38d1d06b.tar.bz2 | |
Move ObjectYAML code to a new library.
It is only ever used by obj2yaml and yaml2obj. No point in linking it
everywhere.
llvm-svn: 262368
Diffstat (limited to 'llvm/unittests/ObjectYAML/YAMLTest.cpp')
| -rw-r--r-- | llvm/unittests/ObjectYAML/YAMLTest.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/llvm/unittests/ObjectYAML/YAMLTest.cpp b/llvm/unittests/ObjectYAML/YAMLTest.cpp new file mode 100644 index 0000000..606e160 --- /dev/null +++ b/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); +} |
