1//===- llvm/unittest/IR/TypesTest.cpp - Type unit tests -------------------===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#include "llvm/IR/DerivedTypes.h" 11#include "llvm/IR/LLVMContext.h" 12#include "gtest/gtest.h" 13using namespace llvm; 14 15namespace { 16 17TEST(TypesTest, StructType) { 18 LLVMContext C; 19 20 // PR13522 21 StructType *Struct = StructType::create(C, "FooBar"); 22 EXPECT_EQ("FooBar", Struct->getName()); 23 Struct->setName(Struct->getName().substr(0, 3)); 24 EXPECT_EQ("Foo", Struct->getName()); 25 Struct->setName(""); 26 EXPECT_TRUE(Struct->getName().empty()); 27 EXPECT_FALSE(Struct->hasName()); 28} 29 30} // end anonymous namespace 31