shithub: mc

ref: 974475bcfe52a488d9f5e83e474b6ca3670d5f6a
dir: /lib/std/test/env.myr/

View raw version
use std
use testr

const main = {
	var e, v

	/* set */
	for var i = 0; i < 100; i++
		e = std.fmt("ENV{}", i)
		v = std.fmt("VAL{}", i)
		std.setenv(e, v)
		std.slfree(e)
		std.slfree(v)
	;;

	for var i = 0; i < 100; i++
		e = std.fmt("ENV{}", i)
		v = std.fmt("VAL{}", i)
		std.assert(std.eq(std.getenvv(e, v), v), "get of {} failed", e)
		std.slfree(e)
		std.slfree(v)
	;;

	for var i = 0; i < 100; i++
		e = std.fmt("ENV{}", i)
		v = std.fmt("VAL{}", 100-i)
		std.setenv(e, v)
		std.slfree(e)
		std.slfree(v)
	;;
	for var i = 0; i < 100; i++
		e = std.fmt("ENV{}", i)
		v = std.fmt("VAL{}", 100-i)
		std.assert(std.eq(std.getenvv(e, v), v), "get of {} failed", e)
		std.slfree(e)
		std.slfree(v)
	;;
}