summaryrefslogtreecommitdiff
path: root/src/map/script-persist.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/script-persist.py')
-rw-r--r--src/map/script-persist.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/map/script-persist.py b/src/map/script-persist.py
index 454c828..df60cf4 100644
--- a/src/map/script-persist.py
+++ b/src/map/script-persist.py
@@ -3,7 +3,17 @@ class script_data(object):
test_extra = '''
using tmwa::operator "" _s;
- #include "../map/script-parse.hpp"
+
+ #include "../map/script-parse-internal.hpp"
+
+ static
+ tmwa::Borrowed<const tmwa::ScriptBuffer> fake_script()
+ {
+ static
+ const std::vector<tmwa::ByteCode> buffer;
+ return borrow(reinterpret_cast<const tmwa::ScriptBuffer&>(buffer));
+ }
+
'''
tests = [
@@ -19,10 +29,8 @@ class script_data(object):
'{<tmwa::sexpr::Variant<tmwa::ScriptDataPos, tmwa::ScriptDataInt, tmwa::ScriptDataParam, tmwa::ScriptDataStr, tmwa::ScriptDataArg, tmwa::ScriptDataVariable, tmwa::ScriptDataRetInfo, tmwa::ScriptDataFuncRef>> = {(tmwa::ScriptDataArg) = {numi = 0}}, <No data fields>}'),
('tmwa::script_data(tmwa::ScriptDataVariable{tmwa::SIR()})',
'{<tmwa::sexpr::Variant<tmwa::ScriptDataPos, tmwa::ScriptDataInt, tmwa::ScriptDataParam, tmwa::ScriptDataStr, tmwa::ScriptDataArg, tmwa::ScriptDataVariable, tmwa::ScriptDataRetInfo, tmwa::ScriptDataFuncRef>> = {(tmwa::ScriptDataVariable) = {reg = {impl = 0}}}, <No data fields>}'),
- # the {script = } is almost certainly a bug in gdb's 'set print address'
- # but the most I can do is check for changes.
- ('tmwa::script_data(tmwa::ScriptDataRetInfo{tmwa::borrow(*tmwa::parse_script("{}"_s, 1, true).release())})',
- 'regex:\{<tmwa::sexpr::Variant<tmwa::ScriptDataPos, tmwa::ScriptDataInt, tmwa::ScriptDataParam, tmwa::ScriptDataStr, tmwa::ScriptDataArg, tmwa::ScriptDataVariable, tmwa::ScriptDataRetInfo, tmwa::ScriptDataFuncRef>> = \{\(tmwa::ScriptDataRetInfo\) = \{script = \}\}, <No data fields>\}'),
+ ('tmwa::script_data(tmwa::ScriptDataRetInfo{fake_script()})',
+ '{<tmwa::sexpr::Variant<tmwa::ScriptDataPos, tmwa::ScriptDataInt, tmwa::ScriptDataParam, tmwa::ScriptDataStr, tmwa::ScriptDataArg, tmwa::ScriptDataVariable, tmwa::ScriptDataRetInfo, tmwa::ScriptDataFuncRef>> = {(tmwa::ScriptDataRetInfo) = {script = <fake_script()::buffer>}}, <No data fields>}'),
('tmwa::script_data(tmwa::ScriptDataFuncRef{404})',
'{<tmwa::sexpr::Variant<tmwa::ScriptDataPos, tmwa::ScriptDataInt, tmwa::ScriptDataParam, tmwa::ScriptDataStr, tmwa::ScriptDataArg, tmwa::ScriptDataVariable, tmwa::ScriptDataRetInfo, tmwa::ScriptDataFuncRef>> = {(tmwa::ScriptDataFuncRef) = {numi = 404}}, <No data fields>}'),
]