summaryrefslogtreecommitdiff
path: root/unittests/IR/TypesTest.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2013-01-07 15:35:46 +0000
committerChandler Carruth <chandlerc@gmail.com>2013-01-07 15:35:46 +0000
commitc779e96158cbac4c62df8e2053ab6a933eba5868 (patch)
tree0ec9e70170d75216c6f0ed5c994a0a0ba1fac2b3 /unittests/IR/TypesTest.cpp
parent3251e81d793a293b78f4914be6093b405c24fc2a (diff)
downloadllvm-c779e96158cbac4c62df8e2053ab6a933eba5868.tar.gz
llvm-c779e96158cbac4c62df8e2053ab6a933eba5868.tar.bz2
llvm-c779e96158cbac4c62df8e2053ab6a933eba5868.tar.xz
Rename the VMCore unittest tree to IR. Somehow was missed when doing the
library rename. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171747 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/IR/TypesTest.cpp')
-rw-r--r--unittests/IR/TypesTest.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/unittests/IR/TypesTest.cpp b/unittests/IR/TypesTest.cpp
new file mode 100644
index 0000000000..2cee640a13
--- /dev/null
+++ b/unittests/IR/TypesTest.cpp
@@ -0,0 +1,30 @@
+//===- llvm/unittest/IR/TypesTest.cpp - Type unit tests -------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/IR/DerivedTypes.h"
+#include "llvm/IR/LLVMContext.h"
+#include "gtest/gtest.h"
+using namespace llvm;
+
+namespace {
+
+TEST(TypesTest, StructType) {
+ LLVMContext C;
+
+ // PR13522
+ StructType *Struct = StructType::create(C, "FooBar");
+ EXPECT_EQ("FooBar", Struct->getName());
+ Struct->setName(Struct->getName().substr(0, 3));
+ EXPECT_EQ("Foo", Struct->getName());
+ Struct->setName("");
+ EXPECT_TRUE(Struct->getName().empty());
+ EXPECT_FALSE(Struct->hasName());
+}
+
+} // end anonymous namespace