Create test framework for testing
As of writing we already have some commands outputting the correct values based on the test data, eg:
$ zig build run -- t test/data/test1/output_llvm-ar_gnu.a
input1.txt
input2.txt
$ zig build run -- t test/data/test2/output_llvm-ar_gnu.a
input1.txt
input2.txt
input3_that_is_also_a_much_longer_file_name.txt
input4_that_is_also_a_much_longer_file_name.txt
As we add features that replicate the functionality of llvm-ar - it would be good to have a set of tests we can use to both test for:
- regression
- features to be implemented
It should be quite simple. For each command using some of the example files to both parse/produce archives and then test those against what was produced by llvm-ar for the same inputs.
Was we only of the t command working (in a very limited way) so far - for the purposes of this issue focusing on that could be a good place to start.
Using what is generated for #1.
I am happy to look into this! I will have a look how llvm-ar implements tests and try to recreate that
I wouldn't start with that - look at how tests are normally done for zig projects. In terms of existing ar implementations, for now I would recommend ignoring them (or only treating them as a black box). The goal isn't to make a copy of an existing implementation but write something new in zig that's as simple as possible but does the same job.
But otherwise so feel free to work on this! I'm looking forward to seeing what you come up with. This is also related to #5.
Ok makes sense! Thanks :)
I've made a little start on this for the most simple case: https://github.com/moosichu/zar/commit/9b06af00f57bc6833d44af729a91d1a948954d3d
(BSD tests are currently commented out because they aren't working - that needs investigating).
However this is very bare-bones, so feedback & fleshing this out to cover the other operations we support as well would be great.
I'll look into it :)