@@ -388,92 +388,85 @@ final class InvalidTests: XCTestCase {
388388 )
389389 }
390390
391- func testInvalid23a( ) {
392- assertParse (
393- """
394- func dog 1️⃣cow() {}
395- """ ,
396- diagnostics: [
397- DiagnosticSpec (
398- message: " found an unexpected second identifier in function " ,
399- fixIts: [
400- " join the identifiers together " ,
401- " join the identifiers together with camel-case " ,
402- ]
403- )
404- ] ,
405- applyFixIts: [ " join the identifiers together " ] ,
406- fixedSource: " func dogcow() {} "
407- )
408- }
409-
410- func testInvalid23b( ) {
411- assertParse (
412- """
413- func dog 1️⃣cow() {}
414- """ ,
415- diagnostics: [
416- DiagnosticSpec (
417- message: " found an unexpected second identifier in function " ,
418- fixIts: [
419- " join the identifiers together " ,
420- " join the identifiers together with camel-case " ,
421- ]
422- )
423- ] ,
424- applyFixIts: [ " join the identifiers together with camel-case " ] ,
425- fixedSource: " func dogCow() {} "
426- )
391+ func testInvalid23( ) {
392+ let testCases : [ UInt : ( fixIt: String , fixedSource: String ) ] = [
393+ #line: ( " join the identifiers together " , " func dogcow() {} " ) ,
394+ #line: ( " join the identifiers together with camel-case " , " func dogCow() {} " ) ,
395+ ]
396+
397+ for (line, testCase) in testCases {
398+ assertParse (
399+ """
400+ func dog 1️⃣cow() {}
401+ """ ,
402+ diagnostics: [
403+ DiagnosticSpec (
404+ message: " found an unexpected second identifier in function; is there an accidental break? " ,
405+ fixIts: [
406+ " join the identifiers together " ,
407+ " join the identifiers together with camel-case " ,
408+ ]
409+ )
410+ ] ,
411+ applyFixIts: [ testCase. fixIt] ,
412+ fixedSource: testCase. fixedSource,
413+ line: line
414+ )
415+ }
427416 }
428417
429418 func testThreeIdentifersForFunctionName( ) {
430- assertParse (
431- """
432- func dog 1️⃣cow sheep() {}
433- """ ,
434- diagnostics: [
435- DiagnosticSpec (
436- message: " found an unexpected second identifier in function " ,
437- fixIts: [
438- " join the identifiers together " ,
439- " join the identifiers together with camel-case " ,
440- ]
441- )
442- ] ,
443- applyFixIts: [ " join the identifiers together with camel-case " ] ,
444- fixedSource: " func dogCowSheep() {} "
445- )
446- }
419+ let testCases : [ UInt : ( fixIt: String , fixedSource: String ) ] = [
420+ #line: ( " join the identifiers together " , " func dogcowsheep() {} " ) ,
421+ #line: ( " join the identifiers together with camel-case " , " func dogCowSheep() {} " ) ,
422+ ]
447423
448- func testInvalid24( ) {
449- assertParse (
450- """
451- func cat 1️⃣Mouse() {}
452- """ ,
453- diagnostics: [
454- DiagnosticSpec ( message: " found an unexpected second identifier in function " , fixIts: [ " join the identifiers together " ] )
455- ] ,
456- fixedSource: " func catMouse() {} "
457- )
424+ for (line, testCase) in testCases {
425+ assertParse (
426+ """
427+ func dog 1️⃣cow sheep() {}
428+ """ ,
429+ diagnostics: [
430+ DiagnosticSpec (
431+ message: " found an unexpected second identifier in function; is there an accidental break? " ,
432+ fixIts: [
433+ " join the identifiers together " ,
434+ " join the identifiers together with camel-case " ,
435+ ]
436+ )
437+ ] ,
438+ applyFixIts: [ testCase. fixIt] ,
439+ fixedSource: testCase. fixedSource,
440+ line: line
441+ )
442+ }
458443 }
459444
460445 func testInvalid25( ) {
461- assertParse (
462- """
463- func friend 1️⃣ship<T>(x: T) {}
464- """ ,
465- diagnostics: [
466- DiagnosticSpec (
467- message: " found an unexpected second identifier in function " ,
468- fixIts: [
469- " join the identifiers together " ,
470- " join the identifiers together with camel-case " ,
471- ]
472- )
473- ] ,
474- applyFixIts: [ " join the identifiers together with camel-case " ] ,
475- fixedSource: " func friendShip<T>(x: T) {} "
476- )
446+ let testCases : [ UInt : ( fixIt: String , fixedSource: String ) ] = [
447+ #line: ( " join the identifiers together " , " func friendship<T>(x: T) {} " ) ,
448+ #line: ( " join the identifiers together with camel-case " , " func friendShip<T>(x: T) {} " ) ,
449+ ]
450+
451+ for (line, testCase) in testCases {
452+ assertParse (
453+ """
454+ func friend 1️⃣ship<T>(x: T) {}
455+ """ ,
456+ diagnostics: [
457+ DiagnosticSpec (
458+ message: " found an unexpected second identifier in function; is there an accidental break? " ,
459+ fixIts: [
460+ " join the identifiers together " ,
461+ " join the identifiers together with camel-case " ,
462+ ]
463+ )
464+ ] ,
465+ applyFixIts: [ testCase. fixIt] ,
466+ fixedSource: testCase. fixedSource,
467+ line: line
468+ )
469+ }
477470 }
478471
479472 func testInvalid26( ) {
0 commit comments