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

42
LINES

< > BotCompany Repo | #1035656 // test_leftArrowScript_tilde

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (37273L) is out of date.

!include once #1034831 // Gazelle 22 Function Include for Testing

scope test_leftArrowScript_tilde

sclass #GetOptImpl {
  public O getOpt(S key) { ret key + "!"; }
}

svoid test_leftArrowScript_tilde() {
  var test = new TestFunctionValues<S, O>(l1 leftArrowVerbose);
  
  // function inversion with an extra argument (2 in total)
  test
    .io([[litmap "a" 2 "b" 3, ~a]], 2)
    .io([[litmap "a" 2 "b" 3, ~b]], 3)
    .io([[litmap "a" 2 "b" 3, ~c]], null)
    .io([[litmap "a" (litmap "x" 2) "b" 3, ~a ~x]], 2).runAndClear();
    
  // get list element
  test
    .io([[ll "a" "b", ~0]], "a")
    .io([[ll "a" "b", ~1]], "b")
    .io([[ll "a" "b", ~2]], null)
    .runAndClear();
    
  // tilde directly after function call
  test
    .io([[def bla { litmap "a" 2 }
          bla~a]], 2)
    .runAndClear();
    
  // Any object implementing getOpt(key)
  test
    .io(replaceIdentifiers([[new GetOptImpl, ~hey]], "GetOptImpl", className(GetOptImpl)), "hey!")
    .runAndClear();
    
  // It's okay to do "null, ~whatever"
  
  test
    .io("null, ~bla", null)
    .runAndClear();
}

Author comment

Began life as a copy of #1035535

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): elmgxqgtpvxh, gjtlkbvenryc, mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1035656
Snippet name: test_leftArrowScript_tilde
Eternal ID of this version: #1035656/12
Text MD5: f8efd9fe48c63aa191f41ff9a28b3675
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-10-21 15:04:28
Source code size: 1129 bytes / 42 lines
Pitched / IR pitched: No / No
Views / Downloads: 115 / 185
Version history: 11 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1036307 - test_leftArrowScript_ifdef
#1036422 - test_leftArrowScript_scriptError [dev.]