File: expressions.bsh

package info (click to toggle)
bsh 2.0b4-20
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 4,224 kB
  • sloc: java: 23,431; xml: 4,500; sh: 139; makefile: 24
file content (59 lines) | stat: -rw-r--r-- 1,058 bytes parent folder | download | duplicates (11)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/java bsh.Interpreter

source("TestHarness.bsh");

java.sql.Date date;
assert( isEvalError("date=5;") ); // can't assign int to Date

import java.sql.Date;
Date date2;
assert( isEvalError("date2=5;") ); // can't assign int to Date

java.sql.Date date3;
assert( isEvalError("date3=5;") ); // can't assign int to Date

bsh.system.shutdownOnExit;

if ( bsh.system.shutdownOnExit == true )
	System.out.println("foo");

// accept expressions as well as block statements
2;
2+2;
(2*2);
(2)*2;
(3*2)+5;
bsh.system.shutdownOnExit == true;

s1="foo";
s2="bar";

s1.equals(s2);
!true;
a=!s1.equals(s2);
(!s1.equals(s2));

// important - expressions with method invocations in them
// used to trigger bug
Math.sin(0.5)*2;
!s1.equals(s2);


// This set of stuff used to trigger nasty bug in PrimaryPrefix lookahead

value="foo";

(value != null) && (value.trim().length() > 0);
(value.trim()!=null) && true;

true && (value.trim().length()!=0);

"foo".trim().trim().trim() != null;

true && (value.trim().length() > 0);

// end - This set of stuff 


complete();