Mirror: The magical sticky regex-based parser generator 🧙

Add test case for self-referential thunk

Changed files
+29
src
babel
+10
src/babel/__snapshots__/plugin.test.js.snap
···
};"
`;
+
exports[`works with self-referential thuns 1`] = `
+
"import { match, tag, _exec, _pattern } from 'reghex';
+
const inner = m('inner')\`
+
\${() => node}
+
\`;
+
const node = m('node')\`
+
\${inner}
+
\`;"
+
`;
+
exports[`works with standard features 1`] = `
"import { match, _exec, _pattern, tag as _tag } from \\"reghex\\";
+19
src/babel/plugin.test.js
···
).toMatchSnapshot();
});
+
it('works with self-referential thuns', () => {
+
const code = `
+
import { match, tag } from 'reghex';
+
+
const inner = m('inner')\`
+
\${() => node}
+
\`;
+
+
const node = m('node')\`
+
\${inner}
+
\`;
+
`;
+
+
expect(
+
transform(code, { babelrc: false, presets: [], plugins: [reghexPlugin] })
+
.code
+
).toMatchSnapshot();
+
});
+
it('works with transform functions', () => {
const code = `
import { match } from 'reghex';