Skip to content

Commit

Permalink
fixes #1913 and fixes tests for getSingleFrom
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenvinju committed Feb 6, 2024
1 parent 3ec7ad8 commit eaa4ad6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/org/rascalmpl/library/lang/rascal/tests/basic/Sets.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,18 @@ test bool tst_takeOneFrom(set[int] S) {

test bool tst_getSingleFrom(set[int] S) {
if ({e} := S) {
return getSingleFrom(s) == e;
return getSingleFrom(S) == e;
}
return false;
return true;
}

test bool tst_getSingleFromExample(str input) {
return getSingleFrom({input}) == input;
}

@expected{CallFailed}
test bool tst_getSingleFromMore(str input, int i) {
getSingleFrom({input, i});
}

test bool tst_toList(set[int] S) = isEmpty(S) || size(S) == size(toList(S)) && all(x <- S, x in toList(S));
Expand Down
1 change: 1 addition & 0 deletions src/org/rascalmpl/semantics/dynamic/Tree.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ private IList flatten(IList args) {
if (nestedArgs.length() > 0) {
appendPreviousSeparators(args, result, delta, i, previousWasEmpty);
result.appendAll(nestedArgs);
previousWasEmpty = false;
}
else {
previousWasEmpty = true;
Expand Down

0 comments on commit eaa4ad6

Please sign in to comment.