Commits

Maciej Fijalkowski committed 95fb3cc

implement print

  • Participants
  • Parent commits 9424211

Comments (0)

Files changed (2)

File kermit/interpreter.py

             right = frame.pop()
             left = frame.pop()
             frame.push(add(left, right))
+        elif c == bytecode.PRINT:
+            item = frame.pop()
+            print item
         else:
             assert False
 

File kermit/test/test_interpreter.py

 def test_interp():
     interpret('1 + 2;')
     # nothing to assert
+
+def test_print(capfd):
+    interpret('print 1;')
+    out, err = capfd.readouterr()
+    assert out == '1\n'