@@ -82,7 +82,7 @@ extension HTMLKitTests {
82
82
83
83
extension HTMLKitTests {
84
84
@Test func test_recursive( ) {
85
- let string : String = #div( [
85
+ let string : StaticString = #div( [
86
86
#div( ) ,
87
87
#div( [ #div( ) , #div( ) , #div( ) ] ) ,
88
88
#div( )
@@ -130,16 +130,26 @@ extension HTMLKitTests {
130
130
}
131
131
132
132
extension HTMLKitTests {
133
- static let spongebob : String = " Spongebob "
134
- static func spongebobCharacter( _ string: StaticString ) -> StaticString {
135
- if string == " patrick " {
136
- return " Patrick Star "
133
+ static let spongebob : String = " Spongebob Squarepants "
134
+ static let patrick : StaticString = " Patrick Star "
135
+ static func spongebobCharacter( _ string: String ) -> StaticString {
136
+ switch string {
137
+ case " spongebob " : return " Spongebob Squarepants "
138
+ case " patrick " : return " Patrick Star "
139
+ default : return " Plankton "
137
140
}
138
- return " Plankton "
139
141
}
140
142
141
143
@Test func test_third_party_literal( ) {
142
- #expect( #div( attributes: [ . title( HTMLKitTests . spongebob) ] ) == " <div title= \" Spongebob \" ></div> " )
144
+ var string : String = #div( attributes: [ . title( HTMLKitTests . spongebob) ] )
145
+ #expect( string == " <div title= \" Spongebob Squarepants \" ></div> " )
146
+
147
+ string = #div( attributes: [ . title( HTMLKitTests . patrick) ] )
148
+ #expect( string == " <div title= \" Patrick Star \" ></div> " )
149
+
150
+ /*let mr_crabs:StaticString = "Mr. Crabs"
151
+ let static_string:StaticString = #div(attributes: [.title(mr_crabs)])
152
+ #expect(static_string == "<div title=\"Mr. Crabs\"></div>")*/
143
153
}
144
154
@Test func test_third_party_func( ) {
145
155
#expect( #div( attributes: [ . title( HTMLKitTests . spongebobCharacter ( " patrick " ) ) ] ) == " <div title= \" Patrick Star \" ></div> " )
0 commit comments