mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-29 15:45:01 +01:00
Add import/ and export/ under function/. Move most top-level tests to a new basics/ with subdirectories for `import` directives and `inline Cpp`. Add subdirectory for primitive type handling. Move all `reverse/` tests to somewhere else, typically under an `export/` directory. I split two test files up: constexpr.carbon got split into var/ and function/ pieces, and reverse/simple.carbon was inlined into namespace/export.carbon. The rest are just simple renames.
44 lines
1.3 KiB
Plaintext
44 lines
1.3 KiB
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
|
|
//
|
|
// INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
|
|
// EXTRA-ARGS: --clang-arg=-Wunused
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/basics/unused_internal.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/basics/unused_internal.carbon
|
|
|
|
// --- unused.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp inline '''c++
|
|
// CHECK:STDERR: unused.carbon:[[@LINE+4]]:12: warning: unused variable 'n' [CppInteropParseWarning]
|
|
// CHECK:STDERR: 9 | static int n = 0;
|
|
// CHECK:STDERR: | ^
|
|
// CHECK:STDERR:
|
|
static int n = 0;
|
|
// CHECK:STDERR: unused.carbon:[[@LINE+4]]:13: warning: unused function 'f' [CppInteropParseWarning]
|
|
// CHECK:STDERR: 14 | static void f() {}
|
|
// CHECK:STDERR: | ^
|
|
// CHECK:STDERR:
|
|
static void f() {}
|
|
''';
|
|
|
|
// --- not_unused.carbon
|
|
|
|
library "[[@TEST_NAME]]";
|
|
|
|
import Cpp inline '''c++
|
|
static int n = 0;
|
|
static void f() {}
|
|
''';
|
|
|
|
fn F() -> i32 {
|
|
Cpp.f();
|
|
return Cpp.n;
|
|
}
|