Files
carbon-lang/explorer/testdata/optional/fail_optional_get_empty.carbon
T
Jon Ross-PerkinsandRichard Smith 73869e9438 Modify lit_autoupdate so that it can handle errors in prelude.carbon (#2612)
The intent here is that changes to prelude.carbon shouldn't break every test that expects some error from prelude.carbon; that would be too fragile. As a consequence, this effectively ignores the line number in prelude.carbon.

This is a little complex because we don't know which line in the original source file is actually causing the error, just that there is an error. Also, the previous look-behind approach required a fixed-with prefix, whereas we want a little more than that in order to capture the filename for comparison.

This would be hard to do with extra_check_replacement because the path to bazel.runfiles is complex to calculate. As a consequence, this is basically all new code.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
2023-02-17 09:31:48 -08:00

16 lines
510 B
Plaintext

// 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
//
// AUTOUPDATE
// RUN: %{not} %{explorer-run}
// RUN: %{not} %{explorer-run-trace}
// CHECK:STDERR: RUNTIME ERROR: {{.*}}/explorer/data/prelude.carbon:{{.*}}: "Attempted to unwrap empty Optional"
package ExplorerTest api;
fn Main() -> i32{
var x: Optional(i32) = Optional(i32).CreateEmpty();
return x.Get();
}