Skip to content

Commit

Permalink
Ported test suite: plugin-flush-line-suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiospampinato committed Sep 14, 2024
1 parent ae58b4a commit ccaeba0
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/__fixtures__/plugin-flush-line-suffix/file.foo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
contents
25 changes: 25 additions & 0 deletions test/__fixtures__/plugin-flush-line-suffix/plugin.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"use strict";

module.exports = {
languages: [
{
name: "foo",
parsers: ["foo-parser"],
extensions: [".foo"],
},
],
parsers: {
"foo-parser": {
parse: (text) => ({ text }),
astFormat: "foo-ast",
},
},
printers: {
"foo-ast": {
print(path) {
// TODO[@fisker]: Use `lineSuffix` after we support ESM plugin
return { type: "line-suffix", contents: path.getValue().text.trim() };
},
},
},
};
15 changes: 15 additions & 0 deletions test/__tests__/plugin-flush-line-suffix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { runCli } from "../utils";

describe("flush all line-suffix content", () => {
runCli("plugin-flush-line-suffix", [
"*.foo",
"--plugin=./plugin.cjs"
], {
ignoreLineEndings: true,
}).test({
stdout: "contents",
stderr: "",
status: 0,
write: [],
});
});

0 comments on commit ccaeba0

Please sign in to comment.