#!/bin/java bsh.Interpreter

// Givin' bsh its props ;)

source("TestHarness.bsh");

// {} syntax
b = new java.awt.Button();
print( b{"name"} );
b{"name"} = "MyButton!";
assert( b{"name"}.equals("MyButton!") );

// extended field style access
b.name = "Test";
assert( b.name.equals("Test") );

// for booleans support both getFoo() and isFoo() style
Float fl = new Float(1.0f);
assert( fl.infinite == false );


// Properties style auto-allocation of object scope relative to 'this' type
// references.
assert( foo == void );

foo.gee1.gee2.gee3 = true;

assert( foo.gee1.gee2.gee3 == true );

foo.bar.blah = true;
foo.bar.blah2 = true;

// Make sure we don't mask undefined static fields
assert( Fields instanceof bsh.ClassIdentifier );
assert( isEvalError("Fields.nonExistent=42") );
Fields.propTest = 42;
assert( Fields.propTest == 42 );

map = new HashMap();
map{"foo"}=5;
assert(map{"foo"} == 5 );
// items put into the map get unwrapped
assert( map{"foo"}.getClass() == Integer.class );

complete();
