Skip to content

Commit 5976b76

Browse files
committed
Increase max length for string literal
1 parent ef55be7 commit 5976b76

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

src/CSharpScriptSerializer/LiteralCSScriptSerializer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public override ExpressionSyntax GetCreation(object obj)
3535
{
3636
typeof(string), x => SyntaxFactory.Literal(
3737
SyntaxTriviaList.Empty,
38-
CSharpObjectFormatter.Instance.FormatObject(x, new PrintOptions {EscapeNonPrintableCharacters = false}),
38+
CSharpObjectFormatter.Instance.FormatObject(x,
39+
new PrintOptions {EscapeNonPrintableCharacters = false, MaximumOutputLength = int.MaxValue}),
3940
(string)x,
4041
SyntaxTriviaList.Empty)
4142
},

src/CSharpScriptSerializer/project.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.1.1-*",
2+
"version": "1.1.2-*",
33
"name": "CSharpScriptSerializer",
44
"title": "CSharpScriptSerializer",
55
"description": "Serialize to C# scripts",
@@ -9,7 +9,7 @@
99
"packOptions": {
1010
"tags": [ "Roslyn", "CSharp", "C#", "CSX", "Script", "Serialization" ],
1111
"owners": [ "Andriy.Svyryd" ],
12-
"releaseNotes": "Version 1.1.1\r\n* Use verbatim literals for multi-line strings\r\n* Remove redundant flags enum values\r\nVersion 1.1.0\r\n* Enable customizing the property serialization condition in PropertyCSScriptSerializer\r\nVersion 1.0.0\r\n* Enable customizing the default values in PropertyCSScriptSerializer\r\n* Change ICSScriptSerializable.GetSerializer() to return ICSScriptSerializer\r\n* Fix parameters not being used in DeserializeAsync\r\n\r\nVersion 1.0.0-alpha1\r\n* Initial release",
12+
"releaseNotes": "Version 1.1.2\r\n* Increase max length for string literals\r\nVersion 1.1.1\r\n* Use verbatim literals for multi-line strings\r\n* Remove redundant flags enum values\r\nVersion 1.1.0\r\n* Enable customizing the property serialization condition in PropertyCSScriptSerializer\r\nVersion 1.0.0\r\n* Enable customizing the default values in PropertyCSScriptSerializer\r\n* Change ICSScriptSerializable.GetSerializer() to return ICSScriptSerializer\r\n* Fix parameters not being used in DeserializeAsync\r\n\r\nVersion 1.0.0-alpha1\r\n* Initial release",
1313
"projectUrl": "https://github.com/AndriySvyryd/CSharpScriptSerializer",
1414
"licenseUrl": "http://www.apache.org/licenses/LICENSE-2.0",
1515
"requireLicenseAcceptance": false,

test/CSharpScriptSerializer.Tests/RoundTrippingTest.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,34 @@ private void ValidateStringLiteral(string input, bool verbatim)
183183
Assert.Equal(input, output);
184184
}
185185

186+
[Fact]
187+
public void LongString()
188+
{
189+
var input = @"
190+
1
191+
2
192+
3
193+
4
194+
5
195+
6
196+
7
197+
8
198+
9
199+
10
200+
11
201+
12
202+
13
203+
14
204+
15
205+
16
206+
17
207+
18
208+
19";
209+
var script = CSScriptSerializer.Serialize(input);
210+
var output = CSScriptSerializer.Deserialize<string>(script);
211+
Assert.Equal(input, output);
212+
}
213+
186214
[Fact]
187215
public void Self_referencing_type()
188216
{

test/CSharpScriptSerializer.Tests/project.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.1.1-*",
2+
"version": "1.1.2-*",
33

44
"buildOptions": {
55
"warningsAsErrors": true
@@ -8,7 +8,7 @@
88
"testRunner": "xunit",
99

1010
"dependencies": {
11-
"CSharpScriptSerializer": "1.1.1-*",
11+
"CSharpScriptSerializer": "1.1.2-*",
1212
"dotnet-test-xunit": "2.2.0-preview2-build1029",
1313
"xunit": "2.2.0-beta4-build3444"
1414
},

0 commit comments

Comments
 (0)