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

26
LINES

< > BotCompany Repo | #1035332 // test_structure_skipDefaultValues

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

Libraryless. Click here for Pure Java version (9432L/54K).

scope test_structure_skipDefaultValues

sclass #X {
  settable int x = 1;
  settable bool b = true;
  settable bool c = false;
  settable L l = ll(1);
  settable S s;
}

svoid testCase(S s, O o) {
  new structure_Data d;
  d.skipDefaultValues(true);
  S x = shortClassName(X);
  s = migrateClassesInStructureText(s, "X", X);
  assertEqualsVerbose(s, structure(o, d));
}

svoid test_structure_skipDefaultValues() {
  testCase("X", new X());
  testCase("X(b=f)", new X().b(false));
  testCase("X(c=t)", new X().c(true));
  testCase("X(l=null)", new X().l(null));
  testCase([[X(s="hello")]], new X().s("hello"));
  testCase("array{}", new O[] {});
}

Author comment

Began life as a copy of #1035330

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035332
Snippet name: test_structure_skipDefaultValues
Eternal ID of this version: #1035332/9
Text MD5: 441cb209ef298386f70b8ab7ada15abd
Transpilation MD5: 1e8635ef3de30345871518a9f3cc0afc
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-01 17:16:53
Source code size: 672 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 147 / 241
Version history: 8 change(s)
Referenced in: [show references]