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:
10
lang/interpret_test/TestAstFunc1/duplicate_resource.graph
Normal file
10
lang/interpret_test/TestAstFunc1/duplicate_resource.graph
Normal 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)
|
||||
17
lang/interpret_test/TestAstFunc1/duplicate_resource/main.mcl
Normal file
17
lang/interpret_test/TestAstFunc1/duplicate_resource/main.mcl
Normal 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",
|
||||
}
|
||||
Reference in New Issue
Block a user