ycl

Artifact [a35e7e5fb6]
Login

Artifact [a35e7e5fb6]

Artifact a35e7e5fb667355554239c8639b9280cc73e946a:



package require {ycl ns}
namespace import [yclprefix]::ns::nsnormalize
package require {ycl parse r}
interp alias {} [namespace current]::r {} [yclprefix]::parse::r
namespace import [yclprefix]::parse::r::parser

package require tcl::chan::string

package require {ycl test data}
package require {ycl test}
[yclprefix]::test::init


proc suite_main {} {
	foreach var [info vars [namespace current]::*] {
		variable $var
	}
	test one {} -setup $setup1 -body {
		parser parser1 $chan
		while {[namespace which parser1] eq "[nsnormalize [namespace current]::parser1]"} {
			parser1
		}
	} -cleanup $cleanup1 -result hmph

	test is_reserved {} -setup $setup1 -body {
		foreach string $syntax {
			lappend res [r is reserved $string]
		}
		set res
	} -cleanup $cleanup1 -result {0 0 0 1 1 1 1 0 0} 

	test is_specialops {} -setup $setup1 -body {
		foreach string $syntax {
			lappend res [r is specialops $string]
		}
		set res
	} -cleanup $cleanup1 -result {{} {} {} {} {} {} {} %in% %uber%} 

	cleanupTests
}

variable setup1 {
	set res [list]
	set chan [tcl::chan::string $rscript]
}

variable cleanup1 {
	close $chan
}

variable rscript {
	c("hello", "there" ,"Bob")
	c(1 ,2 3)
}

variable syntax {
	hello
	1
	.hello
	.
	.1
	..
	..2
	%in%
	%uber%
}