-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/cue/cmd: better checks for incorrect flags
Fixes #969 Change-Id: I1628c5158c996830576dc65e4b6fc667e0009b46 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9821 Reviewed-by: CUE cueckoo <[email protected]> Reviewed-by: Paul Jolly <[email protected]>
- Loading branch information
Showing
3 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Issue #969 | ||
|
||
! cue eval test.json -n ".+\.cue" | ||
cmp stderr expect-stderr1 | ||
|
||
! cue eval test.json -d '#D2' | ||
cmp stderr expect-stderr2 | ||
|
||
! cue eval test.json -n ".+\.cue" -d '#D2' | ||
cmp stderr expect-stderr3 | ||
|
||
! cue eval test.json vector.cue -d '#D1' | ||
cmp stderr expect-stderr4 | ||
|
||
! cue eval test.json vector.cue -d '#D2' | ||
cmp stderr expect-stderr5 | ||
|
||
-- test.json -- | ||
{ | ||
"X": 1, | ||
"Y": 2, | ||
"Z": 3 | ||
} | ||
-- vector.cue -- | ||
package Vector | ||
|
||
#D2: { | ||
X: float | ||
Y: float | ||
} | ||
|
||
#D3: { | ||
X: float | ||
Y: float | ||
Z: float | ||
} | ||
|
||
-- expect-stderr1 -- | ||
use of -n/--name flag without a directory | ||
-- expect-stderr2 -- | ||
-d/--schema flag specified without a schema | ||
-- expect-stderr3 -- | ||
use of -n/--name flag without a directory | ||
-- expect-stderr4 -- | ||
reference "#D1" not found: | ||
--schema:1:1 | ||
-- expect-stderr5 -- | ||
X: conflicting values 1 and float (mismatched types int and float): | ||
./test.json:2:8 | ||
./vector.cue:4:8 |