--[[----------------------------------------------------------------------------

KSLuaErrorsTest.lua

--------------------------------------------------------------------------------

ADOBE CONFIDENTIAL
------------------
Copyright 2010 Adobe Systems Incorporated
All Rights Reserved.

NOTICE: All information contained herein is, and remain the property of
Adobe Systems Incorporated and its suppliers, if any. The intellectual and
technical concepts contained herein are proprietary to Adobe Systems
Incorporated and its suppliers and may be covered by U.S. and Foreign
Patents, patents in process, and are protected by trade secret or copyright
law.  Dissemination of this information or reproduction of this material is
strictly forbidden unless prior written permission is obtained from
Adobe Systems Incorporated.

------------------------------------------------------------------------------]]

local KSLuaErrorsTest = {}

--------------------------------------------------------------------------------

function KSLuaErrorsTest.testErrorsNamespace()

	-- Verify that we have created a namespace at "KSLuaErrors" and that it
	-- contains throwCancelError and isCancelError functions.
	
	local KSLuaErrors = require 'KSLuaErrors'

	local success, message = pcall( function()
		
		KSLuaErrors.throwCancelError()
		
	end )
	
	assert( not success )
	assert( KSLuaErrors.isCancelError( message ) )
	
	success, message = pcall( function()
		
		error "something else"
	
	end )
	
	assert( not success )
	assert( not KSLuaErrors.isCancelError( message ) )

	success, message = pcall( function()
		
		error( 42 )
	
	end )
	
	assert( not success )
	assert( not KSLuaErrors.isCancelError( message ) )

end

--------------------------------------------------------------------------------

return KSLuaErrorsTest
