shithub: mc

ref: f7228d204a9cbe40f7b6286ba8987ef65691bfbd
dir: /lib/date/test/parse.myr/

View raw version
use std
use date

const main = {
	var buf : byte[1024]

	/*Fri 29 Aug 2014 07:47:43 PM UTC*/
	match date.parsefmt("%Y-%m-%d %z", "1932-10-23 +0500")
	| `std.Some d:
		eq(std.bfmt(buf[:], "{D}", d), "1932-10-23 00:00:00 +0500")
	| `std.None:
		std.fatal("Failed to parse date")
	;;
}

const eq = {actual, expected
	if !std.sleq(expected, actual)
		std.fatal("expected date {}, got {}\n", expected, actual)
	;;
}