def prepare_env(): global env env = Environment() path = join(dirname(relpath(__file__)), '..', 'stdlib.diy') interpret_file(path, env)
# -*- coding: utf-8 -*- from nose.tools import assert_equals from os.path import dirname, relpath, join from diylang.interpreter import interpret, interpret_file from diylang.types import Environment env = Environment() path = join(dirname(relpath(__file__)), '..', 'stdlib.diy') interpret_file(path, env) """ Consider these tests as suggestions for what a standard library for your language could contain. Each test function tests the implementation of one stdlib function. Put the implementation in the file `stdlib.diy` at the root directory of the repository. The first function, `not` is already defined for you. It's your job to create the rest, or perhaps something completely different? Anything you put in `stdlib.diy` is also available from the REPL, so feel free to test things out there. $ ./repl → (not #t) #f PS: Note that in these tests, `interpret` is used. In addition to parsing and evaluating, it "unparses" the result, hence strings such as "#t" as the expected result instead of `True`. """
# -*- coding: utf-8 -*- from nose.tools import assert_equals from os.path import dirname, relpath, join from diylang.interpreter import interpret, interpret_file from diylang.types import Environment env = Environment() path = join(dirname(relpath(__file__)), '..', 'stdlib.diy') interpret_file(path, env) """ Consider these tests as suggestions for what a standard library for your language could contain. Each test function tests the implementation of one stdlib function. Put the implementation in the file `stdlib.diy` at the root directory of the repository. The first function, `not` is already defined for you. It's your job to create the rest, or perhaps something completely different? Anything you put in `stdlib.diy` is also available from the REPL, so feel free to test things out there. $ ./repl > (not #t) #f PS: Note that in these tests, `interpret` is used. In addition to parsing and evaluating, it "unparses" the result, hence strings such as "#t" as the expected result instead of `True`.