examples.spec.ts 866 B

1234567891011121314151617181920212223242526
  1. /**
  2. * Copyright (c) 2020-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. * @author Koya Sakuma <koya.sakuma.work@gmail.com>
  4. * Adapted from MolQL project
  5. **/
  6. import { Transpiler } from '../transpiler';
  7. import { _transpiler as transpilers } from '../all';
  8. function testTranspilerExamples(name: string, transpiler: Transpiler) {
  9. describe(`${name} examples`, () => {
  10. const examples = require(`../${name}/examples`).examples;
  11. // console.log(examples);
  12. for (const e of examples) {
  13. it(e.name, () => {
  14. // check if it transpiles and compiles/typechecks.
  15. transpiler(e.value);
  16. });
  17. }
  18. });
  19. }
  20. testTranspilerExamples('pymol', transpilers.pymol);
  21. testTranspilerExamples('vmd', transpilers.vmd);
  22. testTranspilerExamples('jmol', transpilers.jmol);