Skip to content

mc-cc-scripts/TestSuite-lib

Repository files navigation

TestSuite

This emulates the basic ccTweaked functions missing in basic-lua.

  • fs
  • http
  • vector-functions
  • settings
    • (no validations what so ever as of yet)

Additionally it emulates our scm script and includes the json handler - which makes tests a lot easier.

Usage

As this repo emulates many functionalites given by ccTweaked, you might want to test you code outside of Minecraft, maybe even automated. To achieve that, you need to download the scripts listed above and save them in your testingenv.

Ideally you want to add those scripts to your .gitignore and only add them locally / for github actions.

How to use those functions

-- IN YOUR TEST_SPEC:

package.path = "pathToTestSuite-lib_Folder/?.lua;" .. package.path
-- adds all libs to your path, so they are available without specifying their path each time

_G.fs = require("fs")
_G.vector = require("vector")
-- ...
-- _G holds all global variables, so it may be used by your other scripts

local scriptToTest = require("scriptToTest")
-- this script can now access the fs- & vector-functions
-- without any need to modify the script you want to test

How to import these scripts

For how to import the scipts, an example is already used by this repo for some of ITS dependancies (which you will also need):

fetch-deps.sh

About

CC comes with a Vector Type, which needs to be emulated

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •