[llvm] [RISCV] Add ISAInfoTest tests for a few XQCI extensions (PR #120060)

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 04:04:32 PST 2024


================
@@ -662,6 +662,21 @@ TEST(ParseArchString, RejectsConflictingExtensions) {
     EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
               "'xqcia' is only supported for 'rv32'");
   }
+
+  for (StringRef Input : {"rv64i_xqcicsr0p2"}) {
----------------
lenary wrote:

Can we refactor all of these into one loop?

I think a good enough test would be something like:

```
  EXPECT_THAT(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
              ::testing::EndsWith(" is only supported for 'rv32'"));
```

I'm basing this suggestion on the google test docs, where `EndsWith` is a built-in matcher (I'm not sure from which version):
- https://google.github.io/googletest/reference/assertions.html 
- https://google.github.io/googletest/reference/matchers.html



https://github.com/llvm/llvm-project/pull/120060


More information about the llvm-commits mailing list