inherit(lib::test);

class TestExcept{
	
	try_break#Test{
		temp : 0;
		while(1){
			try{
				break;
			}
			finally{
				temp = 100;
			}
		}
		
		assert temp==100;
	}


	fun_try#Test{
		temp : 0;
		e : fun(){
			try{
				throw "throw";	
			}finally{
				temp = 9999;
			}
		}

		try{
			e();
		}
		catch(e){
			assert e.message=="throw";
		}
		finally{
			temp += 1;
		}
		
		assert temp==10000;
	}

	simple#Test{
		try{
			throw "test";
		}
		catch(e){
			assert e.message=="test";
		}
	}

	try_try#Test{
		temp : 0;
		try{
			try{
				
			}finally{
				temp = "finally";
			}
		}
		catch(e){
			assert temp=="finally";
		}
	}

	try_try_try#Test{
		temp : 0;
		try{
			try{
				try{
					throw "test";
				}
				finally{
					temp = "finally";
				}
			}
			finally{
				temp ~= "2";
			}
		}
		catch(e){
			assert (e.message~temp)=="testfinally2";
		}
	}

}

