Skip to content

Commit

Permalink
Add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
shenglol committed Mar 2, 2024
1 parent a200e0f commit 2775e17
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ param defaultExpression bool = 18 != (true || false)
])
param stringLiteral string

@allowed([
@allowed(
// some comment
[
'abc'
'def'
'ghi'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ param defaultExpression bool = 18 != (true || false)
])
param stringLiteral string

@allowed([
@allowed(
// some comment
[
'abc'
'def'
'ghi'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,14 @@ param defaultExpression bool = 18 != (true || false)
])
param stringLiteral string

@allowed([
'abc'
'def'
'ghi'
])
@allowed(
// some comment
[
'abc'
'def'
'ghi'
]
)
param stringLiteralWithAllowedValuesSuperset string = stringLiteral

@secure()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
//@[000:3137) ProgramExpression
//@[000:3162) ProgramExpression
This is a block comment.
*/

Expand Down Expand Up @@ -283,8 +283,10 @@ param defaultExpression bool = 18 != (true || false)
param stringLiteral string
//@[020:0026) | └─AmbientTypeReferenceExpression { Name = string }

@allowed([
//@[000:0105) ├─DeclaredParameterExpression { Name = stringLiteralWithAllowedValuesSuperset }
@allowed(
//@[000:0130) ├─DeclaredParameterExpression { Name = stringLiteralWithAllowedValuesSuperset }
// some comment
[
'abc'
'def'
'ghi'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ param stringLiteral string
//@ "type": "string",
//@ },

@allowed([
@allowed(
// some comment
[
//@ "allowedValues": [
//@ ]
'abc'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,15 @@ param defaultExpression bool = 18 != (true || false)
param stringLiteral string
//@[6:19) Parameter stringLiteral. Type: 'abc' | 'def'. Declaration start char: 0, length: 56

@allowed([
@allowed(
// some comment
[
'abc'
'def'
'ghi'
])
param stringLiteralWithAllowedValuesSuperset string = stringLiteral
//@[6:44) Parameter stringLiteralWithAllowedValuesSuperset. Type: 'abc' | 'def' | 'ghi'. Declaration start char: 0, length: 105
//@[6:44) Parameter stringLiteralWithAllowedValuesSuperset. Type: 'abc' | 'def' | 'ghi'. Declaration start char: 0, length: 130

@secure()
@minLength(2)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
//@[000:3137) ProgramSyntax
//@[000:3162) ProgramSyntax
This is a block comment.
*/
//@[002:0004) ├─Token(NewLine) |\n\n|
Expand Down Expand Up @@ -890,18 +890,22 @@ param stringLiteral string
//@[020:0026) | └─Token(Identifier) |string|
//@[026:0028) ├─Token(NewLine) |\n\n|

@allowed([
//@[000:0105) ├─ParameterDeclarationSyntax
//@[000:0037) | ├─DecoratorSyntax
@allowed(
//@[000:0130) ├─ParameterDeclarationSyntax
//@[000:0062) | ├─DecoratorSyntax
//@[000:0001) | | ├─Token(At) |@|
//@[001:0037) | | └─FunctionCallSyntax
//@[001:0062) | | └─FunctionCallSyntax
//@[001:0008) | | ├─IdentifierSyntax
//@[001:0008) | | | └─Token(Identifier) |allowed|
//@[008:0009) | | ├─Token(LeftParen) |(|
//@[009:0036) | | ├─FunctionArgumentSyntax
//@[009:0036) | | | └─ArraySyntax
//@[009:0010) | | | ├─Token(LeftSquare) |[|
//@[010:0011) | | | ├─Token(NewLine) |\n|
//@[009:0010) | | ├─Token(NewLine) |\n|
// some comment
//@[019:0020) | | ├─Token(NewLine) |\n|
[
//@[004:0031) | | ├─FunctionArgumentSyntax
//@[004:0031) | | | └─ArraySyntax
//@[004:0005) | | | ├─Token(LeftSquare) |[|
//@[005:0006) | | | ├─Token(NewLine) |\n|
'abc'
//@[002:0007) | | | ├─ArrayItemSyntax
//@[002:0007) | | | | └─StringSyntax
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,12 +562,16 @@ param stringLiteral string
//@[020:026) Identifier |string|
//@[026:028) NewLine |\n\n|

@allowed([
@allowed(
//@[000:001) At |@|
//@[001:008) Identifier |allowed|
//@[008:009) LeftParen |(|
//@[009:010) LeftSquare |[|
//@[010:011) NewLine |\n|
//@[009:010) NewLine |\n|
// some comment
//@[019:020) NewLine |\n|
[
//@[004:005) LeftSquare |[|
//@[005:006) NewLine |\n|
'abc'
//@[002:007) StringComplete |'abc'|
//@[007:008) NewLine |\n|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ resource farm 'Microsoft.Web/serverFarms@2019-08-01' = {
}
}

var cosmosDbResourceId = resourceId('Microsoft.DocumentDB/databaseAccounts', cosmosDb.account)
var cosmosDbResourceId = resourceId('Microsoft.DocumentDB/databaseAccounts',
// comment
cosmosDb.account)
var cosmosDbRef = reference(cosmosDbResourceId).documentEndpoint

// this variable is not accessed anywhere in this template and depends on a run-time reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ resource farm 'Microsoft.Web/serverFarms@2019-08-01' = {
}
}

var cosmosDbResourceId = resourceId('Microsoft.DocumentDB/databaseAccounts', cosmosDb.account)
var cosmosDbResourceId = resourceId('Microsoft.DocumentDB/databaseAccounts',
// comment
cosmosDb.account)
var cosmosDbRef = reference(cosmosDbResourceId).documentEndpoint

// this variable is not accessed anywhere in this template and depends on a run-time reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ resource farm 'Microsoft.Web/serverFarms@2019-08-01' = {
}
}

var cosmosDbResourceId = resourceId('Microsoft.DocumentDB/databaseAccounts', cosmosDb.account)
var cosmosDbResourceId = resourceId(
'Microsoft.DocumentDB/databaseAccounts',
// comment
cosmosDb.account
)
var cosmosDbRef = reference(cosmosDbResourceId).documentEndpoint

// this variable is not accessed anywhere in this template and depends on a run-time reference
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

//@[000:13313) ProgramExpression
//@[000:13326) ProgramExpression
//@[000:00000) | └─ResourceDependencyExpression [UNPARENTED]
//@[000:00000) | └─ResourceReferenceExpression [UNPARENTED]
//@[000:00000) | └─ResourceDependencyExpression [UNPARENTED]
Expand Down Expand Up @@ -290,12 +290,14 @@ resource farm 'Microsoft.Web/serverFarms@2019-08-01' = {
}
}

var cosmosDbResourceId = resourceId('Microsoft.DocumentDB/databaseAccounts', cosmosDb.account)
//@[000:00094) ├─DeclaredVariableExpression { Name = cosmosDbResourceId }
//@[025:00094) | └─FunctionCallExpression { Name = resourceId }
var cosmosDbResourceId = resourceId('Microsoft.DocumentDB/databaseAccounts',
//@[000:00107) ├─DeclaredVariableExpression { Name = cosmosDbResourceId }
//@[025:00107) | └─FunctionCallExpression { Name = resourceId }
//@[036:00075) | ├─StringLiteralExpression { Value = Microsoft.DocumentDB/databaseAccounts }
//@[077:00093) | └─PropertyAccessExpression { PropertyName = account }
//@[077:00085) | └─ParametersReferenceExpression { Parameter = cosmosDb }
// comment
cosmosDb.account)
//@[000:00016) | └─PropertyAccessExpression { PropertyName = account }
//@[000:00008) | └─ParametersReferenceExpression { Parameter = cosmosDb }
var cosmosDbRef = reference(cosmosDbResourceId).documentEndpoint

// this variable is not accessed anywhere in this template and depends on a run-time reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@ resource farm 'Microsoft.Web/serverFarms@2019-08-01' = {
}
}

var cosmosDbResourceId = resourceId('Microsoft.DocumentDB/databaseAccounts', cosmosDb.account)
var cosmosDbResourceId = resourceId('Microsoft.DocumentDB/databaseAccounts',
//@ "cosmosDbResourceId": "[resourceId('Microsoft.DocumentDB/databaseAccounts', parameters('cosmosDb').account)]",
// comment
cosmosDb.account)
var cosmosDbRef = reference(cosmosDbResourceId).documentEndpoint

// this variable is not accessed anywhere in this template and depends on a run-time reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ resource farm 'Microsoft.Web/serverFarms@2019-08-01' = {
}
}

var cosmosDbResourceId = resourceId('Microsoft.DocumentDB/databaseAccounts', cosmosDb.account)
//@[04:022) Variable cosmosDbResourceId. Type: string. Declaration start char: 0, length: 94
var cosmosDbResourceId = resourceId('Microsoft.DocumentDB/databaseAccounts',
//@[04:022) Variable cosmosDbResourceId. Type: string. Declaration start char: 0, length: 107
// comment
cosmosDb.account)
var cosmosDbRef = reference(cosmosDbResourceId).documentEndpoint
//@[04:015) Variable cosmosDbRef. Type: any. Declaration start char: 0, length: 64

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

//@[000:13313) ProgramSyntax
//@[000:13326) ProgramSyntax
//@[000:00002) ├─Token(NewLine) |\r\n|
@sys.description('this is basicStorage')
//@[000:00225) ├─ResourceDeclarationSyntax
Expand Down Expand Up @@ -618,30 +618,34 @@ resource farm 'Microsoft.Web/serverFarms@2019-08-01' = {
//@[000:00001) | └─Token(RightBrace) |}|
//@[001:00005) ├─Token(NewLine) |\r\n\r\n|

var cosmosDbResourceId = resourceId('Microsoft.DocumentDB/databaseAccounts', cosmosDb.account)
//@[000:00094) ├─VariableDeclarationSyntax
var cosmosDbResourceId = resourceId('Microsoft.DocumentDB/databaseAccounts',
//@[000:00107) ├─VariableDeclarationSyntax
//@[000:00003) | ├─Token(Identifier) |var|
//@[004:00022) | ├─IdentifierSyntax
//@[004:00022) | | └─Token(Identifier) |cosmosDbResourceId|
//@[023:00024) | ├─Token(Assignment) |=|
//@[025:00094) | └─FunctionCallSyntax
//@[025:00107) | └─FunctionCallSyntax
//@[025:00035) | ├─IdentifierSyntax
//@[025:00035) | | └─Token(Identifier) |resourceId|
//@[035:00036) | ├─Token(LeftParen) |(|
//@[036:00075) | ├─FunctionArgumentSyntax
//@[036:00075) | | └─StringSyntax
//@[036:00075) | | └─Token(StringComplete) |'Microsoft.DocumentDB/databaseAccounts'|
//@[075:00076) | ├─Token(Comma) |,|
//@[077:00093) | ├─FunctionArgumentSyntax
//@[077:00093) | | └─PropertyAccessSyntax
//@[077:00085) | | ├─VariableAccessSyntax
//@[077:00085) | | | └─IdentifierSyntax
//@[077:00085) | | | └─Token(Identifier) |cosmosDb|
//@[085:00086) | | ├─Token(Dot) |.|
//@[086:00093) | | └─IdentifierSyntax
//@[086:00093) | | └─Token(Identifier) |account|
//@[093:00094) | └─Token(RightParen) |)|
//@[094:00096) ├─Token(NewLine) |\r\n|
//@[076:00078) | ├─Token(NewLine) |\r\n|
// comment
//@[010:00012) | ├─Token(NewLine) |\r\n|
cosmosDb.account)
//@[000:00016) | ├─FunctionArgumentSyntax
//@[000:00016) | | └─PropertyAccessSyntax
//@[000:00008) | | ├─VariableAccessSyntax
//@[000:00008) | | | └─IdentifierSyntax
//@[000:00008) | | | └─Token(Identifier) |cosmosDb|
//@[008:00009) | | ├─Token(Dot) |.|
//@[009:00016) | | └─IdentifierSyntax
//@[009:00016) | | └─Token(Identifier) |account|
//@[016:00017) | └─Token(RightParen) |)|
//@[017:00019) ├─Token(NewLine) |\r\n|
var cosmosDbRef = reference(cosmosDbResourceId).documentEndpoint
//@[000:00064) ├─VariableDeclarationSyntax
//@[000:00003) | ├─Token(Identifier) |var|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,19 +403,23 @@ resource farm 'Microsoft.Web/serverFarms@2019-08-01' = {
//@[000:001) RightBrace |}|
//@[001:005) NewLine |\r\n\r\n|

var cosmosDbResourceId = resourceId('Microsoft.DocumentDB/databaseAccounts', cosmosDb.account)
var cosmosDbResourceId = resourceId('Microsoft.DocumentDB/databaseAccounts',
//@[000:003) Identifier |var|
//@[004:022) Identifier |cosmosDbResourceId|
//@[023:024) Assignment |=|
//@[025:035) Identifier |resourceId|
//@[035:036) LeftParen |(|
//@[036:075) StringComplete |'Microsoft.DocumentDB/databaseAccounts'|
//@[075:076) Comma |,|
//@[077:085) Identifier |cosmosDb|
//@[085:086) Dot |.|
//@[086:093) Identifier |account|
//@[093:094) RightParen |)|
//@[094:096) NewLine |\r\n|
//@[076:078) NewLine |\r\n|
// comment
//@[010:012) NewLine |\r\n|
cosmosDb.account)
//@[000:008) Identifier |cosmosDb|
//@[008:009) Dot |.|
//@[009:016) Identifier |account|
//@[016:017) RightParen |)|
//@[017:019) NewLine |\r\n|
var cosmosDbRef = reference(cosmosDbResourceId).documentEndpoint
//@[000:003) Identifier |var|
//@[004:015) Identifier |cosmosDbRef|
Expand Down

0 comments on commit 2775e17

Please sign in to comment.