summaryrefslogtreecommitdiff
path: root/unittests/Support
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-07-19 07:02:10 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-07-19 07:02:10 +0000
commit93c91e39b29142dec1d03a30df9f6e757f56c193 (patch)
tree33a9b014a327e64450b3c9ed46d8c5bdb78ad345 /unittests/Support
parentca089b24d48ef6fa8da2d0bb8c25bb802c4a95c0 (diff)
Notes
Diffstat (limited to 'unittests/Support')
-rw-r--r--unittests/Support/TargetParserTest.cpp5
-rw-r--r--unittests/Support/YAMLIOTest.cpp16
-rw-r--r--unittests/Support/raw_ostream_test.cpp5
3 files changed, 24 insertions, 2 deletions
diff --git a/unittests/Support/TargetParserTest.cpp b/unittests/Support/TargetParserTest.cpp
index b252641f1a131..b9b725f934b3f 100644
--- a/unittests/Support/TargetParserTest.cpp
+++ b/unittests/Support/TargetParserTest.cpp
@@ -737,7 +737,7 @@ TEST(TargetParserTest, AArch64ExtensionFeatures) {
unsigned Extensions = AArch64::AEK_CRC | AArch64::AEK_CRYPTO |
AArch64::AEK_FP | AArch64::AEK_SIMD |
AArch64::AEK_FP16 | AArch64::AEK_PROFILE |
- AArch64::AEK_RAS;
+ AArch64::AEK_RAS | AArch64::AEK_SVE;
for (unsigned i = 0; i <= Extensions; i++)
EXPECT_TRUE(i == 0 ? !AArch64::getExtensionFeatures(i, Features)
@@ -762,7 +762,8 @@ TEST(TargetParserTest, AArch64ArchExtFeature) {
{"simd", "nosimd", "+neon", "-neon"},
{"fp16", "nofp16", "+fullfp16", "-fullfp16"},
{"profile", "noprofile", "+spe", "-spe"},
- {"ras", "noras", "+ras", "-ras"}};
+ {"ras", "noras", "+ras", "-ras"},
+ {"sve", "nosve", "+sve", "-sve"}};
for (unsigned i = 0; i < array_lengthof(ArchExt); i++) {
EXPECT_EQ(StringRef(ArchExt[i][2]),
diff --git a/unittests/Support/YAMLIOTest.cpp b/unittests/Support/YAMLIOTest.cpp
index 5cf0e9d0f5b35..120773a0c8dd8 100644
--- a/unittests/Support/YAMLIOTest.cpp
+++ b/unittests/Support/YAMLIOTest.cpp
@@ -232,6 +232,22 @@ TEST(YAMLIO, TestSequenceMapWriteAndRead) {
}
}
+//
+// Test YAML filename handling.
+//
+static void testErrorFilename(const llvm::SMDiagnostic &Error, void *) {
+ EXPECT_EQ(Error.getFilename(), "foo.yaml");
+}
+
+TEST(YAMLIO, TestGivenFilename) {
+ auto Buffer = llvm::MemoryBuffer::getMemBuffer("{ x: 42 }", "foo.yaml");
+ Input yin(*Buffer, nullptr, testErrorFilename);
+ FooBar Value;
+ yin >> Value;
+
+ EXPECT_TRUE(!!yin.error());
+}
+
//===----------------------------------------------------------------------===//
// Test built-in types
diff --git a/unittests/Support/raw_ostream_test.cpp b/unittests/Support/raw_ostream_test.cpp
index a7a5ce8dd6d45..a75f446e4ba15 100644
--- a/unittests/Support/raw_ostream_test.cpp
+++ b/unittests/Support/raw_ostream_test.cpp
@@ -151,6 +151,11 @@ TEST(raw_ostreamTest, Justify) {
EXPECT_EQ(" xyz", printToString(right_justify("xyz", 6), 6));
EXPECT_EQ("abc", printToString(right_justify("abc", 3), 3));
EXPECT_EQ("big", printToString(right_justify("big", 1), 3));
+ EXPECT_EQ(" on ", printToString(center_justify("on", 9), 9));
+ EXPECT_EQ(" off ", printToString(center_justify("off", 10), 10));
+ EXPECT_EQ("single ", printToString(center_justify("single", 7), 7));
+ EXPECT_EQ("none", printToString(center_justify("none", 1), 4));
+ EXPECT_EQ("none", printToString(center_justify("none", 1), 1));
}
TEST(raw_ostreamTest, FormatHex) {