1 //===- YAML2ObjTest.cpp --------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "llvm/ObjectYAML/yaml2obj.h"
10 #include "llvm/ADT/SmallString.h"
11 #include "llvm/Object/ObjectFile.h"
12 #include "llvm/Support/Error.h"
13 #include "llvm/Testing/Support/Error.h"
14 #include "gtest/gtest.h"
17 using namespace object
;
20 TEST(yaml2ObjectFile
, ELF
) {
21 SmallString
<0> Storage
;
22 Expected
<std::unique_ptr
<ObjectFile
>> ErrOrObj
= yaml2ObjectFile(Storage
, R
"(
28 Machine: EM_X86_64)");
30 ASSERT_THAT_EXPECTED(ErrOrObj
, Succeeded());
32 std::unique_ptr
<ObjectFile
> ObjFile
= std::move(ErrOrObj
.get());
34 ASSERT_TRUE(ObjFile
->isELF());
35 ASSERT_TRUE(ObjFile
->isRelocatableObject());