Closed purpleidea closed 1 year ago
@purpleidea I would like to work on this issue. Can you please update me more on where we need to implement txtar package and why we are doing this changes. Do brief me here for the updates.
Hi @nikzayn ! Please excuse my delayed reply. I've been head deep in some big plumbing for mgmt and didn't notice this earlier.
If you're still interesting in contributing a patch, I'd recommend first writing a new test harness for something like TestAstFunc2. That code is here: https://github.com/purpleidea/mgmt/blob/a7624a2bf97c4dd99745935f68883df907c2e9b3/lang/interpret_test.go#L1012
If you added a new test that used txtar instead of the home-grown setup I have currently, that would be very helpful! The aforementioned test currently looks at these files to build the tests:
https://github.com/purpleidea/mgmt/tree/master/lang/interpret_test/TestAstFunc2/
We'd love to be able to have a new test harness so we could drop txtar files into a new folder and have them appear as new subtests!
If you have any questions, please let me know!
PS: You can find some example txtar files here btw: https://github.com/cue-lang/cue/tree/master/cmd/cue/cmd/testdata/script
Of course, we don't want to do this for cue, but we'd love to be able to do this for our tests so that main.mcl and whatever.output are stored in a single file each! (As seen in: https://github.com/purpleidea/mgmt/tree/master/lang/interpret_test/TestAstFunc2/ )
FYI, I didn't hear from anyone, so I did this for TestAstFunc2:
https://github.com/purpleidea/mgmt/commit/f2e92f80852e06df09c27b2c7760c639ad1ee814
Commit is not merged yet, but queued up. The hash might change as I rebase some other things, but it's available if anyone wants to see. If someone wants to port some other tests to this, please lmk.
I realized there was only one other test: TestAstFunc1
I ported it too. Not merged yet though.
example:
https://github.com/cue-lang/cue/blob/master/cmd/cue/cmd/script_test.go
txtar:
golang.org/x/tools/txtar