[More Detail] [Collapse All]
Feature: Create extension templates

In the end, specification extensions are just [mustache](https-
//mustache.github.io/mustache.5.html) templates outputting the
rendered result to a file.

Two extension levels 'TLA+ extensions' and 'Application extensions'

TLA+ extension - Files in directory 'src/extend' are entry point
called by sbuilder.rb tool. Entry points correpond to TLA+ concepts
such as 'invariants', 'macros', etc.

Application extensions - Files created in directory 'src/extend'
using command `sbuilder.rb extend` use mustache partial mechanism to
include templates in 'src' directory. These templates corrspond to
application architecture e.g. 'interface', 'service', 'correctness',
'transaction' etc.
features/020-extend-interface/001-create-extension-templates.feature
- Background: I have initialized directory strcuture
link

Create directory structure. No extension templates exists.
features/020-extend-interface/001-create-extension-templates.feature:21
Given I run `sbuilder.rb init`
Then the following directories should exist:
Directory
src
src/extend
And the following files should not exist:
TLA + extension templates
src/extend/extend_assumptions.mustache
src/extend/extend_const.mustache
src/extend/extend_implementation.mustache
src/extend/extend_invariant.mustache
src/extend/extend_macros.mustache
src/extend/extend_operations.mustache
src/extend/extend_state.mustache
And the following files should not exist:
Application extension templates
src/assumption
src/correctness
src/possibility
src/infrastructure
src/interface
src/operator
src/service
src/state
src/transaction
- Scenario: sbuilder.rb extend creates extension templates
link

Create TLA+ and application extension templates.
features/020-extend-interface/001-create-extension-templates.feature:53
When I successfully run `sbuilder.rb extend`
Then the following files should exist:
TLA + extension templates
src/extend/extend_assumptions.mustache
src/extend/extend_const.mustache
src/extend/extend_implementation.mustache
src/extend/extend_invariant_cfg.mustache
src/extend/extend_invariant.mustache
src/extend/extend_macros.mustache
src/extend/extend_operations.mustache
src/extend/extend_state.mustache
Then the following files should exist:
Application extension templates
src/assumption
src/correctness
src/possibility
src/infrastructure
src/interface
src/operator
src/service
src/state
src/transaction
- Scenario: sbuilder.rb extesion directory is under directory pointed by --src-dir option
link

Location of extension templates can be changed using --src-dir option
features/020-extend-interface/001-create-extension-templates.feature:81
Given an empty directory "src_dir"
And an empty directory "src_dir/extend"
When I successfully run `sbuilder.rb extend --src-dir src_dir`
Then the following files should exist:
TLA + extension templates
src_dir/extend/extend_assumptions.mustache
src_dir/extend/extend_const.mustache
src_dir/extend/extend_implementation.mustache
src_dir/extend/extend_invariant_cfg.mustache
src_dir/extend/extend_invariant.mustache
src_dir/extend/extend_macros.mustache
src_dir/extend/extend_operations.mustache
src_dir/extend/extend_state.mustache
Then the following files should exist:
Application extension templates
src_dir/assumption
src_dir/correctness
src_dir/possibility
src_dir/infrastructure
src_dir/interface
src_dir/operator
src_dir/service
src_dir/state
src_dir/transaction
- Scenario: Reports an error if extension sub-directory does not exist
link
features/020-extend-interface/001-create-extension-templates.feature:111
Given an empty directory "src_dir"
And I remove the directory "src_dir/extend" with full force
When I run `sbuilder.rb extend --src-dir src_dir`
Then the stderr should contain:
No such directory <src_dir>/extend
And the exit status should not be 0