this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cue/load: add test case for issue 3306

This adds a test case for using `cue/load.Config.PkgName` as `*`,
showing extra files and instances that should not be present.

This behavior will be fixed in a subsequent CL.

For #3306

Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: Ibf19e020ecdfa58e6841d517f5fcf0282615504a
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1198685
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+110 -2
+99 -2
cue/load/loader_test.go
··· 564 564 module: "" 565 565 root: "" 566 566 dir: "" 567 - display:""`}, 568 - } 567 + display:""`}, { 568 + // This test checks that files in parent directories 569 + // do not result in irrelevant instances appearing 570 + // in the result of Instances. 571 + name: "Issue3306", 572 + cfg: &Config{ 573 + Dir: testdataDir, 574 + Package: "*", 575 + }, 576 + args: []string{"./issue3306/..."}, 577 + want: `path: mod.test/test/issue3306@v0:_ 578 + module: mod.test/test@v0 579 + root: $CWD/testdata/testmod 580 + dir: $CWD/testdata/testmod/issue3306 581 + display:./issue3306 582 + files: 583 + $CWD/testdata/testmod/anon.cue 584 + 585 + path: mod.test/test/issue3306@v0:test 586 + module: mod.test/test@v0 587 + root: $CWD/testdata/testmod 588 + dir: $CWD/testdata/testmod/issue3306 589 + display:./issue3306 590 + files: 591 + $CWD/testdata/testmod/test.cue 592 + 593 + path: mod.test/test/issue3306@v0:x 594 + module: mod.test/test@v0 595 + root: $CWD/testdata/testmod 596 + dir: $CWD/testdata/testmod/issue3306 597 + display:./issue3306 598 + files: 599 + $CWD/testdata/testmod/issue3306/x.cue 600 + 601 + path: mod.test/test/issue3306/a@v0:_ 602 + module: mod.test/test@v0 603 + root: $CWD/testdata/testmod 604 + dir: $CWD/testdata/testmod/issue3306/a 605 + display:./issue3306/a 606 + files: 607 + $CWD/testdata/testmod/anon.cue 608 + 609 + path: mod.test/test/issue3306/a@v0:a 610 + module: mod.test/test@v0 611 + root: $CWD/testdata/testmod 612 + dir: $CWD/testdata/testmod/issue3306/a 613 + display:./issue3306/a 614 + files: 615 + $CWD/testdata/testmod/issue3306/a/a.cue 616 + 617 + path: mod.test/test/issue3306/a@v0:b 618 + module: mod.test/test@v0 619 + root: $CWD/testdata/testmod 620 + dir: $CWD/testdata/testmod/issue3306/a 621 + display:./issue3306/a 622 + files: 623 + $CWD/testdata/testmod/issue3306/a/b.cue 624 + 625 + path: mod.test/test/issue3306/a@v0:test 626 + module: mod.test/test@v0 627 + root: $CWD/testdata/testmod 628 + dir: $CWD/testdata/testmod/issue3306/a 629 + display:./issue3306/a 630 + files: 631 + $CWD/testdata/testmod/test.cue 632 + 633 + path: mod.test/test/issue3306/a@v0:x 634 + module: mod.test/test@v0 635 + root: $CWD/testdata/testmod 636 + dir: $CWD/testdata/testmod/issue3306/a 637 + display:./issue3306/a 638 + files: 639 + $CWD/testdata/testmod/issue3306/x.cue 640 + $CWD/testdata/testmod/issue3306/a/x.cue 641 + 642 + path: mod.test/test/issue3306/x@v0:_ 643 + module: mod.test/test@v0 644 + root: $CWD/testdata/testmod 645 + dir: $CWD/testdata/testmod/issue3306/x 646 + display:./issue3306/x 647 + files: 648 + $CWD/testdata/testmod/anon.cue 649 + 650 + path: mod.test/test/issue3306/x@v0:test 651 + module: mod.test/test@v0 652 + root: $CWD/testdata/testmod 653 + dir: $CWD/testdata/testmod/issue3306/x 654 + display:./issue3306/x 655 + files: 656 + $CWD/testdata/testmod/test.cue 657 + 658 + path: mod.test/test/issue3306/x@v0:x 659 + module: mod.test/test@v0 660 + root: $CWD/testdata/testmod 661 + dir: $CWD/testdata/testmod/issue3306/x 662 + display:./issue3306/x 663 + files: 664 + $CWD/testdata/testmod/issue3306/x.cue 665 + $CWD/testdata/testmod/issue3306/x/x.cue`}} 569 666 tdtest.Run(t, testCases, func(t *tdtest.T, tc *loadTest) { 570 667 pkgs := Instances(tc.args, tc.cfg) 571 668
+3
cue/load/testdata/testmod/issue3306/a/a.cue
··· 1 + package a 2 + 3 + a: 4
+3
cue/load/testdata/testmod/issue3306/a/b.cue
··· 1 + package b 2 + 3 + b: 3
+1
cue/load/testdata/testmod/issue3306/a/x.cue
··· 1 + package x
+3
cue/load/testdata/testmod/issue3306/x.cue
··· 1 + package x 2 + 3 + x: 5
+1
cue/load/testdata/testmod/issue3306/x/x.cue
··· 1 + package x