Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

22
LINES

< > BotCompany Repo | #1019847 // Test NotifyingStringBuffer [OK]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (5362L/38K).

1  
!7
2  
3  
set flag NoHTML. // tt
4  
5  
p-exp {
6  
  new NotifyingStringBuffer buf;
7  
  final Var<Int> count = new(0);
8  
  buf.onChange = ll(r { incIntVar(count) });
9  
  
10  
  assertEquals(0L, buf.changes);
11  
  buf.append("yo");
12  
  assertEquals(1L, buf.changes);
13  
  buf.append(' ');
14  
  buf.append("what");
15  
  assertEquals(3L, buf.changes);
16  
  assertEquals(3, count!);
17  
  assertEqualsVerbose("yo what", str(buf));
18  
  
19  
  buf.setLength(2);
20  
  assertEquals(4, count!);
21  
  assertEqualsVerbose("yo", str(buf));
22  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019847
Snippet name: Test NotifyingStringBuffer [OK]
Eternal ID of this version: #1019847/11
Text MD5: 7879a860bd93e7b09c6e415ed903fe8c
Transpilation MD5: 95e9e9ef7d301aa0c7e70d538149ae2e
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-28 21:13:12
Source code size: 492 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 365 / 981
Version history: 10 change(s)
Referenced in: [show references]