Skip to content

Commit b08764e

Browse files
committed
Adjusting test comments
1 parent e401f32 commit b08764e

File tree

3 files changed

+16
-27
lines changed

3 files changed

+16
-27
lines changed

SwiftRustIntegrationTestRunner/SwiftRustIntegrationTestRunnerTests/VecTests.swift

+4-19
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,8 @@ class VecTests: XCTestCase {
9393
XCTAssertEqual(reflected.pop()!, TransparentEnumInsideVecT.VariantB)
9494
}
9595

96-
/// Verify that a Vec<T> of transparent struct can be used as an argument and return
97-
/// type for extern "Rust" functions.
98-
func testReflectVecOfTransparentStruct() throws {
99-
let vec: RustVec<TransparentStructInsideVecT> = RustVec()
100-
vec.push(value: TransparentStructInsideVecT(string: "string".intoRustString(), integer: 10))
101-
102-
let reflected = rust_reflect_vec_transparent_struct(vec)
103-
XCTAssertEqual(reflected.len(), 1)
104-
XCTAssertEqual(reflected.get(index: 0)!.string.toString(), "string")
105-
XCTAssertEqual(reflected.get(index: 0)!.integer, 10)
106-
let popped = try XCTUnwrap(reflected.pop())
107-
XCTAssertEqual(popped.string.toString(), "string")
108-
XCTAssertEqual(popped.integer, 10)
109-
}
110-
111-
/// Verify that a Vec<T> of transparent struct can be used as an argument and return
112-
/// type for extern "Rust" functions.
96+
/// Verify that a Vec<T> of transparent struct with derive(Copy, Clone) can be used
97+
/// as an argument and return type for extern "Rust" functions.
11398
func testReflectVecOfTransparentStructFromCopy() throws {
11499
let vec: RustVec<TransparentStructInsideVecTWithCopy> = RustVec()
115100
vec.push(value: TransparentStructInsideVecTWithCopy(integer: 10))
@@ -121,8 +106,8 @@ class VecTests: XCTestCase {
121106
XCTAssertEqual(popped.integer, 10)
122107
}
123108

124-
/// Verify that a Vec<T> of transparent struct can be used as an argument and return
125-
/// type for extern "Rust" functions.
109+
/// Verify that a Vec<T> of transparent struct with derive(Clone) can be used as an
110+
/// argument and return type for extern "Rust" functions.
126111
func testReflectVecOfTransparentStructFromClone() throws {
127112
let vec: RustVec<TransparentStructInsideVecT> = RustVec()
128113
vec.push(value: TransparentStructInsideVecT(string: "string".intoRustString(), integer: 10))

crates/swift-bridge-ir/src/codegen/codegen_tests/vec_codegen_tests.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,8 @@ void __swift_bridge__$some_function(void* arg);
537537
}
538538
}
539539

540-
/// Verify that we emit Rust, Swift and C header code that allows a transparent struct be used
541-
/// within a Vec<T>.
540+
/// Verify that we emit Rust, Swift and C header code that allows
541+
/// a transparent struct with derive(Clone) to be used within a Vec<T>.
542542
mod transparent_struct_vec_support {
543543
use super::*;
544544

@@ -682,6 +682,8 @@ void* __swift_bridge__$Vec_SomeStruct$as_ptr(void* vec_ptr);
682682
}
683683
}
684684

685+
/// Verify that we emit Rust, Swift and C header code that allows
686+
/// a transparent struct with derive(Copy, Clone) to be used within a Vec<T>.
685687
mod transparent_struct_vec_support_with_copy {
686688
use super::*;
687689

@@ -824,6 +826,8 @@ void* __swift_bridge__$Vec_SomeStruct$as_ptr(void* vec_ptr);
824826
}
825827
}
826828

829+
/// Verify that we DON'T emit Rust, Swift and C header code for a transparent
830+
/// struct with no derived traits.
827831
mod transparent_struct_vec_support_without_derives {
828832
use super::*;
829833

crates/swift-bridge-ir/src/codegen/generate_rust_tokens/vec/vec_of_transparent_struct.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ mod tests {
120120
use crate::test_utils::assert_tokens_eq;
121121
use proc_macro2::{Ident, Span};
122122

123-
/// Verify that we can generate the functions for an opaque Rust type that get exposed to Swift
124-
/// in order to power the `extension MyRustType: Vectorizable { }` implementation on the Swift
125-
/// side.
123+
/// Verify that we can generate the functions for shared struct with derive(Copy, Clone) that
124+
/// gets exposed to Swift in order to power the `extension MyRustType: Vectorizable { }`
125+
/// implementation on the Swift side.
126126
#[test]
127127
fn generates_vectorizable_impl_for_shared_struct_with_copy() {
128128
let expected = quote! {
@@ -201,9 +201,9 @@ mod tests {
201201
);
202202
}
203203

204-
/// Verify that we can generate the functions for an opaque Rust type that get exposed to Swift
205-
/// in order to power the `extension MyRustType: Vectorizable { }` implementation on the Swift
206-
/// side.
204+
/// Verify that we can generate the functions for shared struct with derive(Clone) that
205+
/// gets exposed to Swift in order to power the `extension MyRustType: Vectorizable { }`
206+
/// implementation on the Swift side.
207207
#[test]
208208
fn generates_vectorizable_impl_for_shared_struct_with_clone() {
209209
let expected = quote! {

0 commit comments

Comments
 (0)