Skip to content

Commit

Permalink
Add regression testing for enum name casing
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed Jan 18, 2024
1 parent 898efe9 commit 0a3a5dd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Bonsai.Sgen.Tests/CasingGenerationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ private static Task<JsonSchema> CreateTestSchema()
""type"": ""object"",
""properties"": {
""bar"": {
""type"": [
""null"",
""string""
]
""enum"": [
""This is a string A"",
""This is a string B""
],
""title"": ""StringEnum"",
""type"": ""string""
}
}
}
Expand All @@ -49,7 +51,8 @@ public async Task GenerateFromSnakeCase_GeneratePascalCaseNames()
var schema = await CreateTestSchema();
var generator = TestHelper.CreateGenerator(schema);
var code = generator.GenerateFile();
Assert.IsTrue(code.Contains("public ThingContainer BaseType"), "Incorrect casing for property name.");
Assert.IsTrue(code.Contains("public ThingContainer BaseType"), "Incorrect casing for property type or name.");
Assert.IsTrue(code.Contains("ThisIsAStringA = 0,"), "Incorrect casing for enum name.");
CompilerTestHelper.CompileFromSource(code);
}
}
Expand Down

0 comments on commit 0a3a5dd

Please sign in to comment.