Skip to content

Commit ba5cbee

Browse files
committed
Fix line endings on MacOSX
1 parent d7aa905 commit ba5cbee

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

src/System.ServiceModel.BuildTools/tests/OperationInvokerGeneratorTests.cs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ internal static void RegisterOperationInvokers()
141141
}
142142
#nullable restore
143143
144-
""", Encoding.UTF8, SourceHashAlgorithm.Sha256)),
144+
""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)),
145145
},
146146
},
147147
};
@@ -273,7 +273,7 @@ internal static void RegisterOperationInvokers()
273273
}
274274
#nullable restore
275275
276-
""", Encoding.UTF8, SourceHashAlgorithm.Sha256)),
276+
""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)),
277277
},
278278
},
279279
};
@@ -371,7 +371,7 @@ internal static void RegisterOperationInvokers()
371371
}
372372
#nullable restore
373373
374-
""", Encoding.UTF8, SourceHashAlgorithm.Sha256)),
374+
""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)),
375375
},
376376
},
377377
};
@@ -463,7 +463,7 @@ internal static void RegisterOperationInvokers()
463463
}
464464
#nullable restore
465465
466-
""", Encoding.UTF8, SourceHashAlgorithm.Sha256)),
466+
""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)),
467467
},
468468
},
469469
};
@@ -555,7 +555,7 @@ internal static void RegisterOperationInvokers()
555555
}
556556
#nullable restore
557557
558-
""", Encoding.UTF8, SourceHashAlgorithm.Sha256)),
558+
""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)),
559559
},
560560
},
561561
};
@@ -647,7 +647,7 @@ internal static void RegisterOperationInvokers()
647647
}
648648
#nullable restore
649649
650-
""", Encoding.UTF8, SourceHashAlgorithm.Sha256)),
650+
""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)),
651651
},
652652
},
653653
};
@@ -739,7 +739,7 @@ internal static void RegisterOperationInvokers()
739739
}
740740
#nullable restore
741741
742-
""", Encoding.UTF8, SourceHashAlgorithm.Sha256)),
742+
""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)),
743743
},
744744
},
745745
};
@@ -831,12 +831,25 @@ internal static void RegisterOperationInvokers()
831831
}
832832
#nullable restore
833833
834-
""", Encoding.UTF8, SourceHashAlgorithm.Sha256)),
834+
""".FixLineEndingsOnMacOSX(), Encoding.UTF8, SourceHashAlgorithm.Sha256)),
835835
},
836836
},
837837
};
838838

839839
await test.RunAsync();
840840
}
841841
}
842+
843+
internal static class StringExtensions
844+
{
845+
public static string FixLineEndingsOnMacOSX(this string input)
846+
{
847+
if (Environment.OSVersion.Platform == PlatformID.MacOSX)
848+
{
849+
return input.Replace("\r\n", "\n");
850+
}
851+
852+
return input;
853+
}
854+
}
842855
}

0 commit comments

Comments
 (0)