ourPLCC / plcc

A Programming Languages Compiler Compiler
GNU General Public License v3.0
8 stars 4 forks source link

Reedeveris/clean up testing 103 #106

Closed StoneyJackson closed 8 months ago

StoneyJackson commented 8 months ago
test: isolate tests from each other

---

Closes #103 
StoneyJackson commented 8 months ago

@reedeveris Hmm... getting an error. It looks like it's trying to create a directory in a location that it doesn't have permissions to do that.

StoneyJackson commented 8 months ago

@reedeveris Looks pretty good.

I think we should be using $BATS_TEST_TMPDIR. According to https://bats-core.readthedocs.io/en/stable/writing-tests.html it is unique for each test.

If we do, Bats might cleanup this directory for us and we don't need a teardown.

Maybe we should have a setup that copies the files over to $BATS_TEST_TMPDIR prior to each test. I wonder if it can also reposition the current working directory into $BATS_TEST_TMPDIR (i.e., cd $BATS_TEST_TMPDIR). It may not. Worth a try?

Sorry for the extra work. But I think it's worth getting this right because it's going to be around for a while.

StoneyJackson commented 8 months ago

@reedeveris I'm about to go into some meetings, and I have a number of other things I have to get done before I can circle back to this. So here is what I learned and maybe this will give you some ideas.

So the reason some of the variables (listed here https://bats-core.readthedocs.io/en/latest/writing-tests.html#special-variables) are empty is because we are using an older version of bats.

We are installing bats using apt-get. And it's giving us 1.2. The current version is 1.10 (!!!).

These instructions https://bats-core.readthedocs.io/en/latest/installation.html tell us how to install from source. Using this approach, we can install whatever version we want.

The trick is how to do this consistently across environments/containers. My current thought is to make a script that installs bats using whatever method we choose. Then call this script from Dockerfiles, .gitpod.yml, etc. That way we can easily update the version of bats whenever we like.

github-actions[bot] commented 7 months ago

:tada: This PR is included in version 6.2.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: