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