bad_import.carbon 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/bad_import.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/bad_import.carbon
  12. // --- fail_import_cpp.carbon
  13. library "[[@TEST_NAME]]";
  14. // CHECK:STDERR: fail_import_cpp.carbon:[[@LINE+4]]:1: error: `Cpp` import missing library [CppInteropMissingLibrary]
  15. // CHECK:STDERR: import Cpp;
  16. // CHECK:STDERR: ^~~~~~~~~~~
  17. // CHECK:STDERR:
  18. import Cpp;
  19. // --- fail_import_cpp_library_empty.carbon
  20. library "[[@TEST_NAME]]";
  21. // CHECK:STDERR: fail_import_cpp_library_empty.carbon:[[@LINE+4]]:1: error: `Cpp` import missing library [CppInteropMissingLibrary]
  22. // CHECK:STDERR: import Cpp library "";
  23. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~
  24. // CHECK:STDERR:
  25. import Cpp library "";
  26. // --- fail_import_cpp_library_file_with_quotes.carbon
  27. library "[[@TEST_NAME]]";
  28. // CHECK:STDERR: fail_import_cpp_library_file_with_quotes.carbon:[[@LINE+6]]:1: in import [InImport]
  29. // CHECK:STDERR: fail_import_cpp_library_file_with_quotes.carbon:[[@LINE+5]]: error: fail_import_cpp_library_file_with_quotes.carbon:[[@LINE+5]]:10: fatal error: '\"foo.h\"' file not found
  30. // CHECK:STDERR: 10 | #include "\"foo.h\""
  31. // CHECK:STDERR: | ^~~~~~~~~~~
  32. // CHECK:STDERR: [CppInteropParseError]
  33. // CHECK:STDERR:
  34. import Cpp library "\"foo.h\"";