#!/bin/sh
#! The following hack allows java to reside anywhere in the path.
//bin/sh -c "exec java bsh.Interpreter $0 $*"; exit

source("TestHarness.bsh");

/**
	Test import precedence rules.  Disambiguate with a class import.
	Several cases here, should probably make more test classes.
	Tried them here once...

	Without the disambiguating class import in Java this would cause a compile 
	time error.  In bsh the *later* import takes precedence...
*/

// works
//import ambiguous.pkg1.*;
//import ambiguous.pkg2.*;

// works
import ambiguous.pkg2.*;
import ambiguous.pkg1.*;

// before disambiguation
// earlier import takes precedence
assert( new Foo().pkg.equals("pkg1") );

// Disambiguate with a class import
// Without this in Java the above would be a compile time error.
import ambiguous.pkg2.Foo;

// works
//import ambiguous.pkg1.*;
//import ambiguous.pkg2.*;

// works
//import ambiguous.pkg2.*;
//import ambiguous.pkg1.*;

// after disambiguation
assert( new Foo().pkg.equals("pkg2") );

complete();
