01: /*
02: * TestEmptyResultCmd.java --
03: *
04: * Copyright (c) 2003 Mo DeJong
05: *
06: * See the file "license.terms" for information on usage and
07: * redistribution of this file, and for a DISCLAIMER OF ALL
08: * WARRANTIES.
09: *
10: * RCS: @(#) $Id: TestEmptyResultCmd.java,v 1.1 2003/01/09 08:42:30 mdejong Exp $
11: *
12: */
13:
14: package tcl.lang;
15:
16: class TestEmptyResultCmd implements Command {
17: public void cmdProc(Interp interp, TclObject objv[])
18: throws TclException {
19: if (objv.length == 1) {
20: interp.resetResult();
21: interp.setResult(interp.getResult().isShared());
22: } else if (objv.length == 2) {
23: int refCount;
24: interp.resetResult();
25: TclObject null_result = interp.getResult();
26: refCount = null_result.getRefCount();
27: interp.setResult(null_result);
28: if (refCount != interp.getResult().getRefCount())
29: interp
30: .setResult("setting null result changed ref count");
31: interp.setResult("");
32: interp.setResult(null_result);
33: if (refCount != interp.getResult().getRefCount())
34: interp
35: .setResult("setting null result after non-null changed ref count");
36: interp.setResult("ok");
37: }
38: }
39: }
|