source: trunk/abcl/contrib/jss/jss-tests.lisp @ 14947

Last change on this file since 14947 was 14947, checked in by mevenson, 18 months ago

JSS syntax for fields (Alan Ruttenberg)

<thing> is either {<lisp expression>} or a class name or abbreviation that find-java-class can use

If <thing> is a lisp expression, then it is evaluated (in the lexical environment) and used as an instance
If <thing> is a class name the result of find-java-class is used and a static field access is done.

<field> is either {<lisp expression} or string

If <field> is a lisp expression it should evaluate to a string that names a field
If <field> is a string (no quotes) it is used as the field name

eg. #"" -> (get-java-field (find-java-class ' "baz" t)

#"{foo}.baz" -> (get-java-field (find-java-class foo) "baz" t)

From <>.

File size: 438 bytes
1(in-package :cl-user)
3(defpackage jss-test
4  (:use :cl :cl-user :jss :prove))
6(in-package :jss-test)
8(plan 4)
10(is (read-from-string "#\"{bar}.{foo}\"") '(get-java-field bar foo t))
11(is (read-from-string "#\"{foo}\"") '(get-java-field (load-time-value (find-java-class "")) foo t))
12(is (read-from-string "#\"{bar}.foo\"") '(get-java-field bar "foo" t))
13(is-error (read-from-string "#\"\"") 'simple-error)
Note: See TracBrowser for help on using the repository browser.