FILE(GLOB RUBY_EXAMPLES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.rb)
LIST(REMOVE_ITEM RUBY_EXAMPLES load.rb)

FOREACH(EXAMPLE ${RUBY_EXAMPLES})
	STRING(REGEX REPLACE "(.*).rb" "\\1" EXAMPLE_NAME ${EXAMPLE})
	add_test(NAME ruby-${EXAMPLE_NAME}
			WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
			COMMAND ${RUBY_EXECUTABLE} ${EXAMPLE})
	set_property(TEST ruby-${EXAMPLE_NAME} PROPERTY
		ENVIRONMENT "RUBYLIB=${RUBY_MODULAR_BINARY_DIR}:.")
ENDFOREACH()
FILE(GLOB RUBY_EXAMPLES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.rb)
LIST(REMOVE_ITEM RUBY_EXAMPLES load.rb)

STRING(REGEX REPLACE "(.*)/narray.*$" "\\1" NARRAY_PATH ${NARRAY_LIB})
FOREACH(EXAMPLE ${RUBY_EXAMPLES})
	STRING(REGEX REPLACE "(.*).rb" "\\1" EXAMPLE_NAME ${EXAMPLE})
	add_test(NAME ruby-${EXAMPLE_NAME}
			WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
			COMMAND ${RUBY_EXECUTABLE} ${EXAMPLE})
	set_property(TEST ruby-${EXAMPLE_NAME} PROPERTY
		ENVIRONMENT "RUBYLIB=${RUBY_MODULAR_BINARY_DIR}:${NARRAY_PATH}:.")
ENDFOREACH()
Add narray libary's path to the test env
Add narray libary's path to the test env
