Skip to content

Commit

Permalink
Add positive test case
Browse files Browse the repository at this point in the history
  • Loading branch information
jeskew committed Feb 24, 2025
1 parent 18a42f3 commit 214110b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Bicep.Core.IntegrationTests/ScenarioTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6966,6 +6966,31 @@ public void Modules_with_the_same_name_but_different_scopes_are_permitted()
result.ExcludingLinterDiagnostics().Should().NotHaveAnyDiagnostics();
}

// https://github.com/azure/bicep/issues/15325
[TestMethod]
public void Refinements_are_enforced_on_non_hierarchical_resource_names()
{
var result = CompilationHelper.Compile("""
resource kv 'Microsoft.KeyVault/vaults@2019-09-01' existing = {
name: 'kv'
resource secret 'secrets' = {
name: '!@#$'
properties: {
value: 'value'
}
}
}
""");

result.Should().HaveDiagnostics(new[]
{
("BCP414", DiagnosticLevel.Warning, "The supplied string does not match the expected pattern of /$^[a-zA-Z0-9-]{3,24}$/."),
("BCP414", DiagnosticLevel.Warning, "The supplied string does not match the expected pattern of /$^[a-zA-Z0-9-]{1,127}$/."),
});
}

// https://github.com/azure/bicep/issues/15325
[TestMethod]
public void Refinements_are_not_enforced_on_hierarchical_resource_names()
{
Expand Down

0 comments on commit 214110b

Please sign in to comment.