ComputerCraft Archive

testtemplate

computer utility mc-cc-scripts github

Description

A dependency manager for scripts to use in the mod CC Tweaked of Minecraft.

Installation

Copy one of these commands into your ComputerCraft terminal:

wget:wget https://raw.githubusercontent.com/mc-cc-scripts/script-manager/master/tests/testtemplate.lua testtemplate
Archive:wget https://cc.shobie.xyz/cc/get/gh-mc-cc-scripts-script-manager-tests-testtemplate testtemplate
Quick Install: wget https://cc.shobie.xyz/cc/get/gh-mc-cc-scripts-script-manager-tests-testtemplate testtemplate

Usage

Run: testtemplate

Tags

none

Source

View Original Source

Code Preview

describe("Busted unit testing framework", function()
    describe("should be awesome", function()
        it("should be easy to use", function()
            assert.truthy("Yup.")
        end)

        it("should have lots of features", function()
            -- deep check comparisons!
            assert.are.same({ table = "great" }, { table = "great" })

            -- or check by reference!
            assert.are_not.equal({ table = "great" }, { table = "great" })

            assert.truthy("this is a string") -- truthy: not false or nil

            assert.True(1 == 1)
            assert.is_true(1 == 1)

            assert.falsy(nil)
            assert.has_error(function() error("Wat") end, "Wat")
        end)

        it("should provide some shortcuts to common functions", function()
            assert.are.unique({ { thing = 1 }, { thing = 2 }, { thing = 3 } })
        end)
    end)
end)