File:  [parser3project] / parser3 / tests / 342.html
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Fri Jul 29 15:58:43 2016 UTC (10 years, 1 month ago) by moko
Branches: MAIN
CVS tags: HEAD
table menu code coverage + foreach test added (related to feature #858)

@main[]
$t[^table::create{c1	c2	c3}]
^for[i](1;4){
	^t.insert{a$i	b	c	d	e}
}

code coverage:

^t.menu{
	^t.line[] : $t.c1
	^if(^t.line[]==2){ ^break[] }
}

^t.menu{
	^t.line[] : $t.c1
	^if(^t.line[]==2){ ^break[] }
}[,]

insert/delete during menu:

^t.menu{
	^t.line[] : $t.c1
	^if(^t.line[]==1){
		^t.insert{more}
		^t.insert{more and more}
	}
}

^show[1]

^t.menu{
	^t.line[] : $t.c1
	^if(^t.line[]==1){ ^t.delete[] }
}


foreach exceptions test:

^try-catch{^t.foreach{1}[2]{code}}
^try-catch{^t.foreach[1]{2}{code}}
^try-catch{^t.foreach[1;2;3]}

^t.foreach[n;v]{
	$n : $v.c1
	^if($n==1){
		^v.insert{ups}
		^t.insert{another ups}
	}
}

^show[2]

^t.foreach[n;v]{
	$n : $v.c1
	^if($n==1){ ^v.delete[] }
}[,]

^show[3]

^t.foreach[n;v]{
	$n : $v.c1
	^if($n==1){ ^break[] }
}

^t.foreach[n;v]{
	$n : $v.c1
	^if($n==1){ ^break[] }
}[,]


@show[n]
$n : ^json:string[$t; $.table[array]  $.indent(true) ]

E-mail: