mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-23 15:42:36 +00:00
This has is a nice-to-have for me. Frequently I want to run a specific test, and end up digging through output to be able to copy-paste the run line. This uses TIP lines to inject the command into the file when using AUTOUPDATE. Note, one of the reasons I want this is because "bazel test //toolchain/testing:file_test --test_output=all" has been regularly exceeding bazel's output limit for me (workaround is either opening the output file or specifying an obscure output limit flag), making it a little harder for me to get the commands. However, frequently I'm adding a file and want to iterate on it, so that's really the use case I have in mind here.
83 lines
5.5 KiB
Plaintext
83 lines
5.5 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
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/nested_tuple.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/nested_tuple.carbon
|
|
|
|
var x: ((i32, i32), i32) = ((12, 76), 6);
|
|
|
|
// CHECK:STDOUT: --- nested_tuple.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
|
|
// CHECK:STDOUT: %.1: type = tuple_type () [template]
|
|
// CHECK:STDOUT: %struct: Int32 = struct_value () [template]
|
|
// CHECK:STDOUT: %.2: type = tuple_type (type, type) [template]
|
|
// CHECK:STDOUT: %.3: type = tuple_type ((type, type), type) [template]
|
|
// CHECK:STDOUT: %.4: type = tuple_type (i32, i32) [template]
|
|
// CHECK:STDOUT: %.5: type = tuple_type ((i32, i32), i32) [template]
|
|
// CHECK:STDOUT: %.6: type = ptr_type (i32, i32) [template]
|
|
// CHECK:STDOUT: %.7: type = tuple_type ((i32, i32)*, i32) [template]
|
|
// CHECK:STDOUT: %.8: type = ptr_type ((i32, i32)*, i32) [template]
|
|
// CHECK:STDOUT: %.9: i32 = int_literal 12 [template]
|
|
// CHECK:STDOUT: %.10: i32 = int_literal 76 [template]
|
|
// CHECK:STDOUT: %.11: i32 = int_literal 6 [template]
|
|
// CHECK:STDOUT: %tuple.1: (i32, i32) = tuple_value (%.9, %.10) [template]
|
|
// CHECK:STDOUT: %tuple.2: ((i32, i32), i32) = tuple_value (%tuple.1, %.11) [template]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Core = %Core
|
|
// CHECK:STDOUT: .x = %x
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
|
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
|
|
// CHECK:STDOUT: %int.make_type_32.loc11_10: init type = call constants.%struct() [template = i32]
|
|
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
|
|
// CHECK:STDOUT: %int.make_type_32.loc11_15: init type = call constants.%struct() [template = i32]
|
|
// CHECK:STDOUT: %.loc11_18: (type, type) = tuple_literal (%int.make_type_32.loc11_10, %int.make_type_32.loc11_15)
|
|
// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
|
|
// CHECK:STDOUT: %int.make_type_32.loc11_21: init type = call constants.%struct() [template = i32]
|
|
// CHECK:STDOUT: %.loc11_24.1: ((type, type), type) = tuple_literal (%.loc11_18, %int.make_type_32.loc11_21)
|
|
// CHECK:STDOUT: %.loc11_24.2: type = value_of_initializer %int.make_type_32.loc11_10 [template = i32]
|
|
// CHECK:STDOUT: %.loc11_24.3: type = converted %int.make_type_32.loc11_10, %.loc11_24.2 [template = i32]
|
|
// CHECK:STDOUT: %.loc11_24.4: type = value_of_initializer %int.make_type_32.loc11_15 [template = i32]
|
|
// CHECK:STDOUT: %.loc11_24.5: type = converted %int.make_type_32.loc11_15, %.loc11_24.4 [template = i32]
|
|
// CHECK:STDOUT: %.loc11_24.6: type = converted %.loc11_18, constants.%.4 [template = constants.%.4]
|
|
// CHECK:STDOUT: %.loc11_24.7: type = value_of_initializer %int.make_type_32.loc11_21 [template = i32]
|
|
// CHECK:STDOUT: %.loc11_24.8: type = converted %int.make_type_32.loc11_21, %.loc11_24.7 [template = i32]
|
|
// CHECK:STDOUT: %.loc11_24.9: type = converted %.loc11_24.1, constants.%.5 [template = constants.%.5]
|
|
// CHECK:STDOUT: %x.var: ref ((i32, i32), i32) = var x
|
|
// CHECK:STDOUT: %x: ref ((i32, i32), i32) = bind_name x, %x.var
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %.loc11_30: i32 = int_literal 12 [template = constants.%.9]
|
|
// CHECK:STDOUT: %.loc11_34: i32 = int_literal 76 [template = constants.%.10]
|
|
// CHECK:STDOUT: %.loc11_36.1: (i32, i32) = tuple_literal (%.loc11_30, %.loc11_34)
|
|
// CHECK:STDOUT: %.loc11_39: i32 = int_literal 6 [template = constants.%.11]
|
|
// CHECK:STDOUT: %.loc11_40.1: ((i32, i32), i32) = tuple_literal (%.loc11_36.1, %.loc11_39)
|
|
// CHECK:STDOUT: %.loc11_40.2: ref (i32, i32) = tuple_access file.%x.var, element0
|
|
// CHECK:STDOUT: %.loc11_36.2: ref i32 = tuple_access %.loc11_40.2, element0
|
|
// CHECK:STDOUT: %.loc11_36.3: init i32 = initialize_from %.loc11_30 to %.loc11_36.2 [template = constants.%.9]
|
|
// CHECK:STDOUT: %.loc11_36.4: ref i32 = tuple_access %.loc11_40.2, element1
|
|
// CHECK:STDOUT: %.loc11_36.5: init i32 = initialize_from %.loc11_34 to %.loc11_36.4 [template = constants.%.10]
|
|
// CHECK:STDOUT: %.loc11_36.6: init (i32, i32) = tuple_init (%.loc11_36.3, %.loc11_36.5) to %.loc11_40.2 [template = constants.%tuple.1]
|
|
// CHECK:STDOUT: %.loc11_40.3: init (i32, i32) = converted %.loc11_36.1, %.loc11_36.6 [template = constants.%tuple.1]
|
|
// CHECK:STDOUT: %.loc11_40.4: ref i32 = tuple_access file.%x.var, element1
|
|
// CHECK:STDOUT: %.loc11_40.5: init i32 = initialize_from %.loc11_39 to %.loc11_40.4 [template = constants.%.11]
|
|
// CHECK:STDOUT: %.loc11_40.6: init ((i32, i32), i32) = tuple_init (%.loc11_40.3, %.loc11_40.5) to file.%x.var [template = constants.%tuple.2]
|
|
// CHECK:STDOUT: %.loc11_41: init ((i32, i32), i32) = converted %.loc11_40.1, %.loc11_40.6 [template = constants.%tuple.2]
|
|
// CHECK:STDOUT: assign file.%x.var, %.loc11_41
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|