Exemplo n.º 1
0
 def check_parse(self):
     i = lecter.Interpreter()
     actual = i.parse("pred")
     assert actual  == ("pred", ()),\
            "pred/0 didn't parse right: %s" % str(actual)
     actual = i.parse("pred(arg)")
     assert actual == ("pred", ("arg",)),\
            "pred/1 didn't parse right: %s" % str(actual)
Exemplo n.º 2
0
    def check_assert1(self):
        i = lecter.Interpreter()
        i.eval("hot(fire).")
        assert i.eval("hot(fire)?")==TRUE,\
               "asserting hot(fire) didn't work."

        actual = i.eval("hot($x)?")
        assert actual==({"$x":"fire"},), \
               "can't query about what's hot. (got %s) " % str(actual)
Exemplo n.º 3
0
 def check_truth(self):
     i = lecter.Interpreter()
     assert i.eval("true?")==TRUE,\
            "true shold be true"
     assert i.eval("false?")==FALSE,\
            "false should be false"
Exemplo n.º 4
0
 def check_assert0(self):
     i = lecter.Interpreter()
     i.eval("something.")
     assert i.eval("something?")==TRUE,\
            "asserting something/0 didn't work."
Exemplo n.º 5
0
 def __init__(self):
     cmd.Cmd.__init__(self)
     self.prompt = "lectsh> "
     self.i = lecter.Interpreter()