From dd6ec2b4cb640965466750a17df5f6e67bb71ed5 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 9 Jun 2022 13:47:32 -0700 Subject: [PATCH] Improve test coverage after #1256. (#1286) This change updated a test to use a different example to make sure a diagnostic was still being exercised, but as a consequence lost test coverage of the situation the test was originally intended to cover. Add back the old test and put the new test into a different file. --- .../impl/fail_impl_as_non_interface.carbon | 17 +++++++++++++++++ .../impl/fail_impl_as_parameterized.carbon | 7 +++++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 explorer/testdata/impl/fail_impl_as_non_interface.carbon diff --git a/explorer/testdata/impl/fail_impl_as_non_interface.carbon b/explorer/testdata/impl/fail_impl_as_non_interface.carbon new file mode 100644 index 000000000000..9c94b1bc2339 --- /dev/null +++ b/explorer/testdata/impl/fail_impl_as_non_interface.carbon @@ -0,0 +1,17 @@ +// Part of the Carbon Language project, under the Apache License v2.0 with LLVM +// Exceptions. See /LICENSE for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +// RUN: %{not} %{explorer} %s 2>&1 | \ +// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s +// RUN: %{not} %{explorer} --parser_debug --trace_file=- %s 2>&1 | \ +// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s +// AUTOUPDATE: %{explorer} %s + +package ExplorerTest api; + +// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/impl/fail_impl_as_non_interface.carbon:[[@LINE+1]]: expected constraint after `as`, found value of type String +external impl i32 as String {} + +fn Main() -> i32 { +} diff --git a/explorer/testdata/impl/fail_impl_as_parameterized.carbon b/explorer/testdata/impl/fail_impl_as_parameterized.carbon index 88a439d0ccb8..88789d002331 100644 --- a/explorer/testdata/impl/fail_impl_as_parameterized.carbon +++ b/explorer/testdata/impl/fail_impl_as_parameterized.carbon @@ -10,8 +10,11 @@ package ExplorerTest api; -// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/impl/fail_impl_as_parameterized.carbon:[[@LINE+1]]: expected constraint after `as`, found value of type String -external impl i32 as String {} +interface Vector(Scalar:! Type) { +} + +// CHECK: COMPILATION ERROR: {{.*}}/explorer/testdata/impl/fail_impl_as_parameterized.carbon:[[@LINE+1]]: Expected a type, but got Vector +external impl i32 as Vector {} fn Main() -> i32 { }