Skip to content

Commit be331d2

Browse files
committed
Update tests
1 parent 7c24207 commit be331d2

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

tests/cmdline/config_sample.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[zxbc]
2-
optimization_level = 1
2+
optimization_level = 3
33
org = 31234

tests/cmdline/test_zxb.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ def file_bas():
3030
return os.path.join(PATH, 'empty.bas')
3131

3232

33+
@pytest.fixture
34+
def config_file():
35+
return os.path.join(PATH, 'config_sample.ini')
36+
37+
3338
@pytest.fixture
3439
def file_bin():
3540
return os.path.join(PATH, 'empty.bin')
@@ -49,3 +54,20 @@ def test_org_allows_0xnnnn_format(file_bas, file_bin):
4954
with EnsureRemoveFile(file_bin):
5055
zxbc.main(['--parse-only', '--org', '0xC000', file_bas, '-o', file_bin])
5156
assert zxbc.OPTIONS.org == 0xC000, 'Should set ORG to 0xC000'
57+
58+
59+
def test_org_loads_ok_from_config_file_format(file_bas, file_bin, config_file):
60+
""" Should allow hexadecimal format 0x in org
61+
"""
62+
with EnsureRemoveFile(file_bin):
63+
zxbc.main(['--parse-only', '-F', config_file, file_bas, '-o', file_bin])
64+
assert zxbc.OPTIONS.org == 31234, 'Should set ORG to 31234'
65+
66+
67+
def test_cmdline_should_override_config_file(file_bas, file_bin, config_file):
68+
""" Should allow hexadecimal format 0x in org
69+
"""
70+
with EnsureRemoveFile(file_bin):
71+
zxbc.main(['--parse-only', '-F', config_file, '--org', '1234', file_bas, '-o', file_bin])
72+
assert zxbc.OPTIONS.org == 1234, 'Commandline should override config file'
73+
assert zxbc.OPTIONS.optimization_level == 3, 'Commandline should override config file'

0 commit comments

Comments
 (0)