File: props.bsh

package info (click to toggle)
bsh 2.0b4-15
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 4,212 kB
  • sloc: java: 23,430; xml: 4,500; sh: 139; makefile: 30
file content (39 lines) | stat: -rw-r--r-- 854 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/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 );

complete();