Sha256: 0bd21566b015d8a4a9d4a3c57868ad102d518d35894cb7172e4d10e2d311d17e

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

import inkcpp_py as ink
import pytest
import os

class Cnt:
    def __init__(self):
        self.cnt = 0
    def __call__(self, _):
        self.cnt += 1
class TestExternalFunctions:
    def test_lookaheadSafe(self, assets, generate):
        cnt = Cnt()
        [story, globals, runner] = generate(assets['LookaheadSafe'])
        runner.bind_void("foo", cnt, True)
        out = runner.getline()
        assert out == "Call1 glued to Call 2\n"
        assert cnt.cnt == 3
        out = runner.getline()
        assert out == "Call 3 is seperated\n"
        assert cnt.cnt == 4

    def test_lookahadeUnsafe(self, assets, generate):
        cnt = Cnt()
        [story, globals, runner] = generate(assets['LookaheadSafe'])
        runner.bind_void("foo", cnt)
        out = runner.getline()
        assert out == "Call1\n"
        assert cnt.cnt == 1
        out = runner.getline()
        assert out == "glued to Call 2\n"
        assert cnt.cnt == 2
        out = runner.getline()
        assert out == "Call 3 is seperated\n"
        assert cnt.cnt == 3
    

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
inkcpp_rb-0.1.3 ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_ExternalFunctions.py
inkcpp_rb-0.1.2 ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_ExternalFunctions.py
inkcpp_rb-0.1.1 ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_ExternalFunctions.py
inkcpp_rb-0.1.0 ext/inkcpp_rb/inkcpp/inkcpp_py/tests/test_ExternalFunctions.py