Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
no line break for aref node
Browse files Browse the repository at this point in the history
  • Loading branch information
flyerhzm committed Feb 18, 2021
1 parent 72fa7f5 commit 40f2d02
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ruby/nodes/aref.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ function printArefField(path, opts, print) {
concat([
printedArray,
"[",
indent(concat([softline, join(concat([",", line]), printedIndex)])),
concat([softline, "]"])
indent(concat([join(concat([",", line]), printedIndex)])),
"]"
])
);
}
Expand Down
4 changes: 3 additions & 1 deletion test/js/ruby/nodes/aref.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { ruby } = require("../../utils");
const { long, ruby } = require("../../utils");

describe("aref", () => {
test("literal reference", () => expect("array[5]").toMatchFormat());
Expand All @@ -23,4 +23,6 @@ describe("aref", () => {

return expect(contents).toMatchFormat();
});

test("long reference", () => expect(`${long}[idx]`).toMatchFormat());
});

0 comments on commit 40f2d02

Please sign in to comment.