SC.FeatureDetector (sc v1.0.2)
View SourceDetects SCXML features used in documents to enable proper test validation.
This module analyzes SCXML documents (either raw XML strings or parsed SC.Document structures) to identify which SCXML features are being used. This enables the test framework to fail appropriately when tests depend on unsupported features.
Summary
Functions
Detects features used in an SCXML document.
Returns a registry of all known SCXML features with their support status.
Checks if all detected features are supported.
Functions
@spec detect_features(String.t() | SC.Document.t()) :: MapSet.t(atom())
Detects features used in an SCXML document.
Takes either a raw XML string or a parsed SC.Document and returns a MapSet of feature atoms representing the SCXML features detected in the document.
Examples
iex> xml = "<scxml><state id='s1'><transition event='go' target='s2'/></state></scxml>"
iex> SC.FeatureDetector.detect_features(xml)
#MapSet<[:basic_states, :event_transitions]>
iex> {:ok, document} = SC.Parser.SCXML.parse(xml)
iex> SC.FeatureDetector.detect_features(document)
#MapSet<[:basic_states, :event_transitions]>
@spec feature_registry() :: %{ required(atom()) => :supported | :unsupported | :partial }
Returns a registry of all known SCXML features with their support status.
Features are categorized as:
:supported- Fully implemented and working:unsupported- Not yet implemented:partial- Partially implemented (may work in simple cases)
Checks if all detected features are supported.
Returns {:ok, features} if all features are supported,
or {:error, unsupported_features} if any unsupported features are detected.