Skip to content

Commit

Permalink
Ported test suite: plugin-extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiospampinato committed Sep 14, 2024
1 parent ccaeba0 commit 2a2bc09
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/__fixtures__/plugin-extensions/file.foo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
contents
24 changes: 24 additions & 0 deletions test/__fixtures__/plugin-extensions/plugin.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"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) {
return ["!", path.getValue().text];
},
},
},
};
15 changes: 15 additions & 0 deletions test/__tests__/plugin-extensions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { runCli } from "../utils";

describe("uses 'extensions' from languages to determine parser", () => {
runCli("plugin-extensions", [
"*.foo",
"--plugin=./plugin.cjs",
], {
ignoreLineEndings: true,
}).test({
stdout: "!contents",
stderr: "",
status: 0,
write: [],
});
});
2 changes: 1 addition & 1 deletion test/__tests__/plugin-flush-line-suffix.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { runCli } from "../utils";
describe("flush all line-suffix content", () => {
runCli("plugin-flush-line-suffix", [
"*.foo",
"--plugin=./plugin.cjs"
"--plugin=./plugin.cjs",
], {
ignoreLineEndings: true,
}).test({
Expand Down

0 comments on commit 2a2bc09

Please sign in to comment.