Validate the value for using namespace during semantic checks to prevent declaring invalid namespaces (#21162)

This commit is contained in:
Dongbo Wang
2024-02-01 09:42:37 -08:00
committed by GitHub
parent 4f02a89906
commit 783fb46e65
3 changed files with 45 additions and 8 deletions
@@ -128,7 +128,10 @@ Describe "Using Namespace" -Tags "CI" {
ShouldBeParseError "1; using namespace System" UsingMustBeAtStartOfScript 3
ShouldBeParseError "using namespace Foo = System" UsingStatementNotSupported 0
ShouldBeParseError "using namespace ''" InvalidNamespaceValue 16
ShouldBeParseError "using namespace [System]" InvalidNamespaceValue 16
ShouldBeParseError "using namespace ',System'" InvalidNamespaceValue 16
ShouldBeParseError "using namespace ']System'" InvalidNamespaceValue 16
# TODO: add diagnostic (low pri)
# ShouldBeParseError "using namespace System; using namespace System" UsingNamespaceAlreadySpecified 24
}