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

42
LINES

< > BotCompany Repo | #1018476 // Test Expecters [usually OK]

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

Download Jar. Libraryless. Click here for Pure Java version (8155L/60K).

!7

p-exp {
  loadFunctions_preferDiskCache();

  assertFalseVerbose(ExpectANumberOfLines(2).check(5));
  assertFalseVerbose(ExpectANumberOfLines(2).check("one line"));
  assertFalseVerbose(ExpectANumberOfLines(2).check("one line\n"));
  assertTrueVerbose(ExpectANumberOfLines(2).check("one line\ntwo lines"));
  assertTrueVerbose(ExpectANumberOfLines(2).check("one line\ntwo lines\n"));
  
  assertTrueVerbose(ExpectContainsOnce_string(".").check("a.b"));
  assertFalseVerbose(ExpectContainsOnce_string(".").check("a..b"));
  assertFalseVerbose(ExpectContainsOnce_string(".").check("a"));
  
  assertTrueVerbose(ExpectForEachLine(ExpectContainsOnce_string(".")).check("a.b\nc.d"));
  assertFalseVerbose(ExpectForEachLine(ExpectContainsOnce_string(".")).check("a.b\nc,d"));
  
  assertTrueVerbose(ExpectInteger().check("1"));
  assertTrueVerbose(ExpectInteger().check("-1"));
  assertFalseVerbose(ExpectInteger().check("x"));
  assertTrueVerbose(ExpectInteger().check(1));
  
  assertTrueVerbose(ExpectAfterSF('trim, new ExpectInteger).check(" 1 "));
  assertFalseVerbose(ExpectAfterSF('trim, new ExpectInteger).check(" x "));
  
  assertTrueVerbose(ExpectElementAtIndex(0, 'bla).check(ll('bla, 'blubb)));
  assertFalseVerbose(ExpectElementAtIndex(1, 'bla).check(ll('bla, 'blubb)));
  assertTrueVerbose(ExpectElementAtIndex(1, 'blubb).check(ll('bla, 'blubb)));
  assertFalseVerbose(ExpectElementAtIndex(0, 'blubb).check(ll('bla, 'blubb)));
  
  assertTrueVerbose(ExpectAnd(ExpectInteger(), ExpectEquals("5")).check("5"));
  assertFalseVerbose(ExpectAnd(ExpectInteger(), ExpectEquals("x")).check("x"));
  assertFalseVerbose(ExpectAnd(ExpectInteger(), ExpectEquals("x")).check("5"));
  
  assertTrueVerbose(ExpectNumberedLines().check("1. bla\n2. blubb"));
  assertFalseVerbose(ExpectNumberedLines().check("1. bla\n3. blubb"));
  assertFalseVerbose(ExpectNumberedLines().check("bla"));
  
  assertTrueVerbose(ExpectLength(2).check(ll("a", "b")));
  assertFalseVerbose(ExpectLength(3).check(ll("a", "b")));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1018476
Snippet name: Test Expecters [usually OK]
Eternal ID of this version: #1018476/13
Text MD5: e16f0a4c6cf15e15dea5dc6c38aa91f4
Transpilation MD5: 0f36cf614aa4011727dd2301c14f9f9e
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-01 22:23:37
Source code size: 2046 bytes / 42 lines
Pitched / IR pitched: No / No
Views / Downloads: 534 / 1281
Version history: 12 change(s)
Referenced in: