init
	Test.init( ref args )
	Test.add_func( "/FunctionalTests/Genie/Variables/AnonymousFunctions/01", test1 )
	Test.add_func( "/FunctionalTests/Genie/Variables/AnonymousFunctions/02", test2 )
	Test.add_func( "/FunctionalTests/Genie/Variables/AnonymousFunctions/03", test3 )
	Test.add_func( "/FunctionalTests/Genie/Variables/AnonymousFunctions/04", test4 )
	Test.add_func( "/FunctionalTests/Genie/Variables/AnonymousFunctions/05", test5 )
	Test.add_func( "/FunctionalTests/Genie/Variables/AnonymousFunctions/06", test6 )
	Test.run()

// Simplest variable declaration with anonymous function
delegate Anonymous1( a:int )
def test1()
	x:Anonymous1 = def( a )
		assert( a == 1 )
	x( 1 )

// Simplest variable declaration with anonymous function and whitespace between def and opening parens
delegate Anonymous2( a:int )
def test2()
	x:Anonymous2 = def   ( a )
		assert( a == 1 )
	x( 1 )

// Simple anonymous function with indentation inside block
delegate Anonymous3( a:int )
def test3()
	x:Anonymous3 = def( a )
		if a == 1
			assert( a == 1 )
		else
			assert_not_reached()
	x( 1 )

// Variable declaration with anonymous function that returns a value
delegate Anonymous4( i:int, j:int, k:int ):int
def test4()
	x:Anonymous4 = def( a, b, c )
		return a + b + c
	var result = x( 1, 2, 3 )
	assert( result == 6 )

// Variable declaration with anonymous function and return statement inside block
delegate Anonymous5( i:int )
def test5()
	x:Anonymous5 = def( a )
		if a != 1
			assert( a != 1 )
			return
		assert( a == 1 )
		return
	x( 1 )

// Variable declaration with anonymous function and return value inside block
delegate Anonymous6( i:int ):int
def test6()
	x:Anonymous6 = def( a )
		if a != 1
			assert( a != 1 )
			return a
		assert( a == 1 )
		return a
	assert( x( 1 ) == 1 )
	assert( x( 2 ) == 2 )
