local h = require("harness") local t = h.module("require") t.check("a module runs once, and every require gets it", function() local first = require("lib/counter") assert(require("./lib/counter") == first, "a second copy") assert(first.loads() == 1, "it ran " .. first.loads() .. " times") end) t.check("a module that requires itself is an error", function() local why = h.refused(require, "lib/cycle_a") assert(why:find("requires itself", 1, true), why) end) t.check("a module that is not there is an error", function() h.refused(require, "lib/missing") end) t.check("a module outside the package is refused", function() h.refused(require, "../manifest") h.refused(require, "C:/Windows/win") end)