mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-24 16:10:46 -06:00
refactoring: TestValidateMoves/cyclic_chain can now pass
When originally filling out these test cases we didn't yet have the logic in place to detect chained moves and so this test couldn't succeed in spite of being correct. We now have chain-detection implemented and so consequently we can also detect cyclic chains. This commit largely just enables the original test unchanged, although it does include the text of the final error message for reporting cyclic move chains which wasn't yet finalized when we were stubbing out this test case originally.
This commit is contained in:
parent
2afa0a5e75
commit
b4594551f7
@ -129,10 +129,6 @@ func TestValidateMoves(t *testing.T) {
|
||||
},
|
||||
WantError: `Redundant move statement: This statement declares a move from module.a to the same address, which is the same as not declaring this move at all.`,
|
||||
},
|
||||
/*
|
||||
// TODO: This test can't pass until we've implemented
|
||||
// addrs.MoveEndpointInModule.CanChainFrom, which is what
|
||||
// detects the chaining condition this is testing for.
|
||||
"cyclic chain": {
|
||||
Statements: []MoveStatement{
|
||||
makeTestMoveStmt(t,
|
||||
@ -151,9 +147,13 @@ func TestValidateMoves(t *testing.T) {
|
||||
`module.a`,
|
||||
),
|
||||
},
|
||||
WantError: `bad cycle`,
|
||||
WantError: `Cyclic dependency in move statements: The following chained move statements form a cycle, and so there is no final location to move objects to:
|
||||
- test:1,1: module.a[*] → module.b[*]
|
||||
- test:1,1: module.b[*] → module.c[*]
|
||||
- test:1,1: module.c[*] → module.a[*]
|
||||
|
||||
A chain of move statements must end with an address that doesn't appear in any other statements, and which typically also refers to an object still declared in the configuration.`,
|
||||
},
|
||||
*/
|
||||
"module.single as a call still exists in configuration": {
|
||||
Statements: []MoveStatement{
|
||||
makeTestMoveStmt(t,
|
||||
|
Loading…
Reference in New Issue
Block a user