Skip to content

Commit

Permalink
test: add more test cases for schema inherit and modification in-place.
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy committed Oct 18, 2023
1 parent 48f16db commit a9285db
Show file tree
Hide file tree
Showing 14 changed files with 143 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/grammar/schema/assign_stmt/assign_stmt_0/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
schema Metadata:
environment?: str = "qa"
region?: str
name?: str

schema MySchema1:
metadata?: Metadata = {}

metadata.environment = "dev"
metadata.region = "us-east-1"

output = MySchema1 {
metadata.name = "config"
}
5 changes: 5 additions & 0 deletions test/grammar/schema/assign_stmt/assign_stmt_0/stdout.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
output:
metadata:
environment: dev
region: us-east-1
name: config
14 changes: 14 additions & 0 deletions test/grammar/schema/assign_stmt/assign_stmt_1/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
schema Metadata:
environment?: str = "qa"
region?: str
name?: str

schema MySchema1:
metadata?: Metadata = {}

metadata.environment = "dev"


output = MySchema1 {
metadata.name = "config"
}
4 changes: 4 additions & 0 deletions test/grammar/schema/assign_stmt/assign_stmt_1/stdout.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output:
metadata:
environment: dev
name: config
13 changes: 13 additions & 0 deletions test/grammar/schema/assign_stmt/assign_stmt_2/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
schema Metadata:
environment?: str = "qa"
region?: str
name?: str

schema MySchema1:
metadata?: Metadata = {
name = "config"
}
metadata.environment = "dev"
metadata.region = "us-east-1"

output = MySchema1 {}
5 changes: 5 additions & 0 deletions test/grammar/schema/assign_stmt/assign_stmt_2/stdout.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
output:
metadata:
environment: dev
region: us-east-1
name: config
16 changes: 16 additions & 0 deletions test/grammar/schema/assign_stmt/assign_stmt_3/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
schema Metadata:
environment: str
region: str
name: str

schema MySchema1:
metadata: Metadata

schema MySchema2(MySchema1):
metadata.environment = "dev"

schema MySchema3(MySchema2):
metadata.region = "us-east-1"

output = MySchema3 {metadata.name = "hello"}

5 changes: 5 additions & 0 deletions test/grammar/schema/assign_stmt/assign_stmt_3/stdout.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
output:
metadata:
environment: dev
region: us-east-1
name: hello
18 changes: 18 additions & 0 deletions test/grammar/schema/assign_stmt/assign_stmt_4/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
schema Metadata:
environment: str
region: str
name: str

schema MySchema1:
metadata: Metadata

schema MySchema2(MySchema1):
metadata.environment = "dev"

schema MySchema3(MySchema2):
metadata.region = "us-east-1"

output = MySchema3 {
metadata.name = "hello"
metadata.environment = "qa"
}
5 changes: 5 additions & 0 deletions test/grammar/schema/assign_stmt/assign_stmt_4/stdout.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
output:
metadata:
environment: dev
region: us-east-1
name: hello
16 changes: 16 additions & 0 deletions test/grammar/schema/optional_attr/inherit_2/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
schema Metadata:
environment: str
region: str
name: str

schema MySchema1:
metadata: Metadata

schema MySchema2(MySchema1):
metadata: Metadata {environment = "dev"}

schema MySchema3(MySchema2):
metadata: Metadata {region = "us-east-1"}

output = MySchema3 {metadata.name = "hello"}

5 changes: 5 additions & 0 deletions test/grammar/schema/optional_attr/inherit_2/stdout.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
output:
metadata:
environment: dev
region: us-east-1
name: hello
18 changes: 18 additions & 0 deletions test/grammar/schema/optional_attr/inherit_3/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
schema Metadata:
environment: str
region: str
name: str

schema MySchema1:
metadata: Metadata

schema MySchema2(MySchema1):
metadata: Metadata {environment = "dev"}

schema MySchema3(MySchema2):
metadata: Metadata {region = "us-east-1"}

output = MySchema3 {
metadata.name = "hello"
metadata.environment = "qa"
}
5 changes: 5 additions & 0 deletions test/grammar/schema/optional_attr/inherit_3/stdout.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
output:
metadata:
environment: qa
region: us-east-1
name: hello

0 comments on commit a9285db

Please sign in to comment.