lang: test: Add a test of duplicate resource generation

These two cases should be allowed in our language. This is something
that puppet got wrong, and hopefully this makes writing modules more
sane in mcl, since two modules both depending on a "cowsay" package
won't cause compile errors.

This only checks the language. The de-duplication is done there. We
don't currently have a check for this in the engine. (We should!)
This commit is contained in:
James Shubin
2018-12-28 18:06:14 -05:00
parent 880c4d2f48
commit 22105af720
2 changed files with 27 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
Edge: str(hello world) -> call:fmt.printf(str(hello world)) # a
Vertex: call:fmt.printf(str(hello world))
Vertex: str(/tmp/foo)
Vertex: str(/tmp/foo)
Vertex: str(cowsay)
Vertex: str(cowsay)
Vertex: str(hello world)
Vertex: str(hello world)
Vertex: str(installed)
Vertex: str(newest)

View File

@@ -0,0 +1,17 @@
import "fmt"
# these two resources are identical to each other, so we should allow it
file "/tmp/foo" {
content => "hello world",
}
file "/tmp/foo" {
content => fmt.printf("hello world"),
}
# these two resources are compatible with each other, so we should allow it
pkg "cowsay" {
state => "installed",
}
pkg "cowsay" {
state => "newest",
}