1.8 KiB
1.8 KiB
BizTools Examples Test Results
Working Examples
All examples have been fixed and now work correctly:
bizmodel.vsh- This example was already working correctly.bizmodel1.vsh- Fixed to useplaybook.new()with text parameter.bizmodel2.vsh- Fixed to useplaybook.new()with text parameter.bizmodel_complete.vsh- Fixed to useplaybook.new()with path parameter.bizmodel_export.vsh- Fixed to useplaybook.new()with path parameter.bizmodel_full.vsh- Fixed to useplaybook.new()with path parameter.costs.vsh- Fixed to useplaybook.new()with text parameter.funding.vsh- Fixed to useplaybook.new()with text parameter.hr.vsh- Fixed to useplaybook.new()with text parameter.
Previous Issues
All examples had issues with the bizmodel.play() function:
- Unknown field (
heroscriptorheroscript_path) in struct literal of typePlayBook. - Reference field
PlayBook.sessionmust be initialized. - Function
bizmodel.playparameterplbookismut, so it requiresmut PlayBook{...}instead.
Solution Applied
All examples have been fixed by using the playbook.new() function to create a properly initialized PlayBook:
For examples with heroscript text:
// Create a new playbook with the heroscript text
mut pb := playbook.new(text: heroscript)!
// Play the bizmodel actions
bizmodel.play(mut pb)!
// Get the bizmodel and print it
mut bm := bizmodel.get('test')!
For examples with heroscript path:
// Create a new playbook with the heroscript path
mut pb := playbook.new(path: heroscript_path)!
// Play the bizmodel actions
bizmodel.play(mut pb)!
Environment Setup
- Tests were performed with V language version 0.4.11 a11de72
- Redis server was running during tests
- All tests were executed from the
/workspace/project/herolib/examples/biztoolsdirectory