add compile test
This commit is contained in:
parent
58b596854b
commit
e96eb4c6f0
4 changed files with 60 additions and 0 deletions
|
|
@ -2221,6 +2221,30 @@ layers: {
|
|||
}`,
|
||||
expErr: `d2/testdata/d2compiler/TestCompile/link-board-underscore-not-found.d2:7:9: invalid underscore usage`,
|
||||
},
|
||||
{
|
||||
name: "border-radius-negative",
|
||||
text: `x
|
||||
x: {
|
||||
style.border-radius: -1
|
||||
}`,
|
||||
expErr: `d2/testdata/d2compiler/TestCompile/border-radius-negative.d2:3:24: expected "border-radius" to be a number between 0 and 20`,
|
||||
},
|
||||
{
|
||||
name: "border-radius-more-than-20",
|
||||
text: `x
|
||||
x: {
|
||||
style.border-radius: 21
|
||||
}`,
|
||||
expErr: `d2/testdata/d2compiler/TestCompile/border-radius-more-than-20.d2:3:24: expected "border-radius" to be a number between 0 and 20`,
|
||||
},
|
||||
{
|
||||
name: "border-radius-more-than-100-percent",
|
||||
text: `x
|
||||
x: {
|
||||
style.border-radius: 1.5
|
||||
}`,
|
||||
expErr: `d2/testdata/d2compiler/TestCompile/border-radius-more-than-100-percent.d2:3:24: expected "border-radius" to be an integer if greater than 1`,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
|
|
|||
12
testdata/d2compiler/TestCompile/border-radius-more-than-100-percent.exp.json
generated
vendored
Normal file
12
testdata/d2compiler/TestCompile/border-radius-more-than-100-percent.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"graph": null,
|
||||
"err": {
|
||||
"ioerr": null,
|
||||
"errs": [
|
||||
{
|
||||
"range": "d2/testdata/d2compiler/TestCompile/border-radius-more-than-100-percent.d2,2:23:30-2:26:33",
|
||||
"errmsg": "d2/testdata/d2compiler/TestCompile/border-radius-more-than-100-percent.d2:3:24: expected \"border-radius\" to be an integer if greater than 1"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
12
testdata/d2compiler/TestCompile/border-radius-more-than-20.exp.json
generated
vendored
Normal file
12
testdata/d2compiler/TestCompile/border-radius-more-than-20.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"graph": null,
|
||||
"err": {
|
||||
"ioerr": null,
|
||||
"errs": [
|
||||
{
|
||||
"range": "d2/testdata/d2compiler/TestCompile/border-radius-more-than-20.d2,2:23:30-2:25:32",
|
||||
"errmsg": "d2/testdata/d2compiler/TestCompile/border-radius-more-than-20.d2:3:24: expected \"border-radius\" to be a number between 0 and 20"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
12
testdata/d2compiler/TestCompile/border-radius-negative.exp.json
generated
vendored
Normal file
12
testdata/d2compiler/TestCompile/border-radius-negative.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"graph": null,
|
||||
"err": {
|
||||
"ioerr": null,
|
||||
"errs": [
|
||||
{
|
||||
"range": "d2/testdata/d2compiler/TestCompile/border-radius-negative.d2,2:23:30-2:25:32",
|
||||
"errmsg": "d2/testdata/d2compiler/TestCompile/border-radius-negative.d2:3:24: expected \"border-radius\" to be a number between 0 and 20"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue