<commit_before>local core = require "sys.core"
local testaux = require "testaux"

local modules = {
	"testjson",
	"testdom",
	"testtimer",
	"testsocket",
	"testdns",
	"testrpc",
	"testudp",
	"testwakeup",
	"testwaitgroup",
	"testmulticast",
	"testnetstream",
	"testnetpacket",
	"testchannel",
	"testcrypto",
	"testhttp",
	"testwebsocket",
	"testredis",
	"testmysql",
	"testexit",
}

local M = ""
local gprint = print
local function print(...)
	gprint(M, ...)
end

assert(core.envget("hello") == "world")

_ENV.print = print

local ok, res = pcall(core.wait)
assert(not ok)

core.start(function()
	local entry = {}
	for k, v in pairs(modules) do
		entry[k] = require(v)
	end
	for k, v in ipairs(modules) do
		M = v .. ":"
		print("=========start=========")
		testaux.module(v)
		assert(entry[k])()
		print("======success==========")
	end
end)<commit_msg>pcall module test code for catch unexpected error<commit_after>local core = require "sys.core"
local testaux = require "testaux"

local modules = {
	"testjson",
	"testdom",
	"testtimer",
	"testsocket",
	"testdns",
	"testrpc",
	"testudp",
	"testwakeup",
	"testwaitgroup",
	"testmulticast",
	"testnetstream",
	"testnetpacket",
	"testchannel",
	"testcrypto",
	"testhttp",
	"testwebsocket",
	"testredis",
	"testmysql",
	"testexit",
}

local M = ""
local gprint = print
local function print(...)
	gprint(M, ...)
end

assert(core.envget("hello") == "world")

_ENV.print = print

local ok, res = pcall(core.wait)
assert(not ok)

core.start(function()
	local entry = {}
	for k, v in pairs(modules) do
		entry[k] = require(v)
	end
	for k, v in ipairs(modules) do
		M = v .. ":"
		print("=========start=========")
		testaux.module(v)
		local ok, err = pcall(entry[k])
		if not ok then
			print(err)
			core.exit(1)
		end
		print("======success==========")
	end
end)
{'fraction_non_alphanumeric': 0.2029867256637168, 'fraction_numerical': 0.0005530973451327434, 'mean_word_length': 4.515243902439025, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3164135', 'n_tokens_mistral': 731, 'n_tokens_neox': 701, 'n_words': 166}