-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Escape literals in public constant string (#288)
- Loading branch information
Showing
2 changed files
with
50 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using PublicApiGeneratorTests.Examples; | ||
|
||
namespace PublicApiGeneratorTests | ||
{ | ||
public class Constants : ApiGeneratorTestsBase | ||
{ | ||
// https://github.com/PublicApiGenerator/PublicApiGenerator/issues/82 | ||
[Fact] | ||
public void Should_escape_literals_in_public_constant_string() | ||
{ | ||
AssertPublicApi<MyConstants>( | ||
@"namespace PublicApiGeneratorTests.Examples | ||
{ | ||
public class MyConstants | ||
{ | ||
public const string MULTILINE1 = ""This\\r\\nIs\\r\\nMultiline\\r\\n""; | ||
public const string MULTILINE2 = ""This\\nIs\\nMultiline\\n""; | ||
public const string SINGLELINE = ""ABC""; | ||
public MyConstants() { } | ||
} | ||
}"); | ||
} | ||
} | ||
|
||
namespace Examples | ||
{ | ||
public class MyConstants | ||
{ | ||
public const string SINGLELINE = "ABC"; | ||
public const string MULTILINE1 = "This\r\nIs\r\nMultiline\r\n"; | ||
public const string MULTILINE2 = "This\nIs\nMultiline\n"; | ||
} | ||
} | ||
} |