Skip to content

Commit 3670cfb

Browse files
committed
tests
1 parent 96d526f commit 3670cfb

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

Sources/UCFTests/CodelinkLegacyDocC.swift

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,115 @@ struct CodelinkLegacyDocC:ParsingSuite
235235
#expect(link.path.hasTrailingParentheses)
236236
#expect(link.suffix == .signature(.function([nil, "Int"], [nil, "Int"])))
237237
}
238+
239+
@Test
240+
static func PatternComplexSignature1() throws
241+
{
242+
let link:UCF.Selector = try Self.roundtrip("f(_:)-(Int?)->Int?")
243+
244+
#expect(link.path.components == ["f(_:)"])
245+
#expect(link.suffix == .signature(.function(["Int?"], ["Int?"])))
246+
}
247+
@Test
248+
static func PatternComplexSignature2() throws
249+
{
250+
let link:UCF.Selector = try Self.roundtrip("f(_:)-((Int?))->(Int?)")
251+
252+
#expect(link.path.components == ["f(_:)"])
253+
#expect(link.suffix == .signature(.function(["Int?"], ["Int?"])))
254+
}
255+
@Test
256+
static func PatternComplexSignature3() throws
257+
{
258+
let link:UCF.Selector = try Self.roundtrip("f(_:)-([(Int?)].Type)->[Int?].Type")
259+
260+
#expect(link.path.components == ["f(_:)"])
261+
#expect(link.suffix == .signature(.function(["[Int?].Type"], ["[Int?].Type"])))
262+
}
263+
@Test
264+
static func PatternComplexSignature4() throws
265+
{
266+
let link:UCF.Selector = try Self.roundtrip("f(_:)-([[T]:Set<T>],[T])->[[Int?]??:`A B`]")
267+
268+
#expect(link.path.components == ["f(_:)"])
269+
#expect(link.suffix == .signature(.function(
270+
["[[T]:Set<T>]", "[T]"],
271+
["[[Int?]??:`A B`]"])))
272+
}
273+
@Test
274+
static func PatternComplexSignature5() throws
275+
{
276+
let link:UCF.Selector = try Self.roundtrip("f(_:)-(Foo<T,U>.Out.Type)")
277+
278+
#expect(link.path.components == ["f(_:)"])
279+
#expect(link.suffix == .signature(.function(["Foo<T,U>.Out.Type"])))
280+
}
281+
@Test
282+
static func PatternComplexSignature6() throws
283+
{
284+
let link:UCF.Selector = try Self.roundtrip("f(_:)-(Foo<[T].Type,U<T>?>.Out.Type)")
285+
286+
#expect(link.path.components == ["f(_:)"])
287+
#expect(link.suffix == .signature(.function(["Foo<[T].Type,U<T>?>.Out.Type"])))
288+
}
289+
@Test
290+
static func PatternComplexSignature7() throws
291+
{
292+
let link:UCF.Selector = try Self.roundtrip("f(_:)-(Foo<([(T)]).Type,(U<T>?)>.Out.Type)")
293+
294+
#expect(link.path.components == ["f(_:)"])
295+
#expect(link.suffix == .signature(.function(["Foo<[T].Type,U<T>?>.Out.Type"])))
296+
}
297+
@Test
298+
static func PatternComplexSignature8() throws
299+
{
300+
let link:UCF.Selector = try Self.roundtrip("f(_:)-(((Foo<T>)))->((()))")
301+
302+
#expect(link.path.components == ["f(_:)"])
303+
#expect(link.suffix == .signature(.function(["Foo<T>"], [])))
304+
}
305+
@Test
306+
static func PatternComplexSignature9() throws
307+
{
308+
let link:UCF.Selector = try Self.roundtrip("f(_:)->(((Foo<T>)))->((()))")
309+
310+
dump(link.suffix!)
311+
312+
#expect(link.path.components == ["f(_:)"])
313+
#expect(link.suffix == .signature(.returns(["(Foo<T>)->()"])))
314+
}
315+
@Test
316+
static func PatternComplexSignature10() throws
317+
{
318+
let link:UCF.Selector = try Self.roundtrip("f(_:)->(((Foo<T>)))->((Int))")
319+
320+
dump(link.suffix!)
321+
322+
#expect(link.path.components == ["f(_:)"])
323+
#expect(link.suffix == .signature(.returns(["(Foo<T>)->Int"])))
324+
}
325+
@Test
326+
static func PatternComplexSignature11() throws
327+
{
328+
let link:UCF.Selector = try Self.roundtrip("f(_:)-(((_)))->((_),_)")
329+
330+
#expect(link.path.components == ["f(_:)"])
331+
#expect(link.suffix == .signature(.function([nil], [nil, nil])))
332+
}
333+
@Test
334+
static func PatternComplexSignature12() throws
335+
{
336+
let link:UCF.Selector = try Self.roundtrip("f(_:)-(((_)))->((),())")
337+
338+
#expect(link.path.components == ["f(_:)"])
339+
#expect(link.suffix == .signature(.function([nil], ["()", "()"])))
340+
}
341+
@Test
342+
static func PatternComplexSignature13() throws
343+
{
344+
let link:UCF.Selector = try Self.roundtrip("f(_:)-(((_)))->(((((())),((())))))")
345+
346+
#expect(link.path.components == ["f(_:)"])
347+
#expect(link.suffix == .signature(.function([nil], ["()", "()"])))
348+
}
238349
}

0 commit comments

Comments
 (0)