summaryrefslogtreecommitdiffstats
path: root/mlir/unittests/IR/DialectTest.cpp
blob: 1438d3226529d4d2ce24f19df66ebc5105c1df91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//===- DialectTest.cpp - Dialect unit tests -------------------------------===//
//
// Part of the MLIR Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "mlir/IR/Dialect.h"
#include "gtest/gtest.h"

using namespace mlir;
using namespace mlir::detail;

namespace {
struct TestDialect : public Dialect {
  TestDialect(MLIRContext *context) : Dialect(/*name=*/"test", context) {}
};

TEST(DialectDeathTest, MultipleDialectsWithSameNamespace) {
  MLIRContext context;

  // Registering a dialect with the same namespace twice should result in a
  // failure.
  new TestDialect(&context);
  ASSERT_DEATH(new TestDialect(&context), "");
}

} // end namespace
OpenPOWER on IntegriCloud