diff options
Diffstat (limited to 'conformance/scenario-schema.json')
| -rw-r--r-- | conformance/scenario-schema.json | 536 |
1 files changed, 536 insertions, 0 deletions
diff --git a/conformance/scenario-schema.json b/conformance/scenario-schema.json new file mode 100644 index 0000000..10fde22 --- /dev/null +++ b/conformance/scenario-schema.json @@ -0,0 +1,536 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://clever-f.invalid/conformance/scenario-schema.json", + "title": "clever-f host-neutral conformance scenarios", + "type": "object", + "required": ["format_version", "scenarios"], + "additionalProperties": false, + "properties": { + "format_version": { "const": 1 }, + "scenarios": { + "type": "array", + "items": { "$ref": "#/$defs/scenario" } + } + }, + "$defs": { + "position": { + "type": "object", + "required": ["line", "byte_column"], + "additionalProperties": false, + "properties": { + "line": { "type": "integer", "minimum": 1 }, + "byte_column": { "type": "integer", "minimum": 1 } + } + }, + "selection": { + "type": "object", + "required": ["active", "kind", "anchor", "focus", "option"], + "additionalProperties": false, + "properties": { + "active": { "type": "boolean" }, + "kind": { + "enum": ["none", "character", "line", "block"] + }, + "anchor": { + "oneOf": [ + { "$ref": "#/$defs/position" }, + { "type": "null" } + ] + }, + "focus": { + "oneOf": [ + { "$ref": "#/$defs/position" }, + { "type": "null" } + ] + }, + "option": { "enum": ["inclusive", "exclusive"] } + } + }, + "target": { + "type": "object", + "required": ["kind", "value", "first_code"], + "additionalProperties": false, + "properties": { + "kind": { "enum": ["character", "special_key", "code_fallback"] }, + "value": { "type": "string" }, + "first_code": { "type": "integer", "minimum": 0 } + } + }, + "context_record": { + "type": "object", + "additionalProperties": false, + "properties": { + "previous_descriptor": { + "oneOf": [ + { "enum": ["f", "F", "t", "T"] }, + { "type": "null" } + ] + }, + "previous_landing": { + "oneOf": [ + { "$ref": "#/$defs/position" }, + { "type": "null" } + ] + }, + "first_move": { + "oneOf": [ + { "type": "boolean" }, + { "type": "null" } + ] + }, + "previous_target": { + "oneOf": [ + { "$ref": "#/$defs/target" }, + { "type": "null" } + ] + } + } + }, + "state": { + "type": "object", + "additionalProperties": false, + "properties": { + "contexts": { + "type": "object", + "additionalProperties": { "$ref": "#/$defs/context_record" } + }, + "last_input_context": { + "oneOf": [ + { "type": "string" }, + { "type": "null" } + ] + }, + "moved_forward": { "type": "boolean" }, + "moved_forward_initialized": { "type": "boolean" }, + "migemo_cache": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true + }, + "repeat_timestamp_ms": { "type": "number" }, + "highlight_timer": { + "oneOf": [ + { "type": "string" }, + { "type": "null" } + ] + }, + "target_overlays": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true + }, + "temporary_overlays": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true + }, + "finalizers": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true + } + } + }, + "input_packet": { + "type": "object", + "required": ["kind"], + "additionalProperties": false, + "properties": { + "kind": { "enum": ["text", "raw_bytes", "special_key", "error"] }, + "text": { "type": "string" }, + "bytes": { + "type": "array", + "items": { "type": "integer", "minimum": 0, "maximum": 255 } + }, + "name": { "type": "string" }, + "message": { "type": "string" } + } + }, + "event": { + "type": "object", + "required": ["name"], + "additionalProperties": false, + "properties": { + "name": { + "enum": [ + "CursorMoved", + "InsertEnter", + "TextChanged", + "WinEnter", + "WinLeave", + "CmdwinLeave", + "ColorScheme" + ] + }, + "time_ms": { "type": "number" }, + "cursor": { "$ref": "#/$defs/position" }, + "buffer_lines": { + "type": "array", + "items": { "type": "string" } + } + } + }, + "configuration_value": { + "oneOf": [ + { "type": "boolean" }, + { "type": "integer" }, + { "type": "string" }, + { "type": "array", "items": { "type": "string" } }, + { "type": "null" } + ] + }, + "action_step": { + "type": "object", + "required": ["operation"], + "additionalProperties": false, + "properties": { + "operation": { + "enum": ["action", "event", "timer_callback", "set_cursor", "set_mode", "set_selection", "set_state", "editor_key"] + }, + "action": { + "enum": [ + "StartFindForward", + "StartFindBackward", + "StartTillForward", + "StartTillBackward", + "RepeatSameDirection", + "RepeatOppositeDirection", + "Reset", + "DiagnosticFullReset", + "DotRepeat" + ] + }, + "event_index": { "type": "integer", "minimum": 0 }, + "timer_identity": { "type": "string" }, + "position": { "$ref": "#/$defs/position" }, + "mode": { "type": "string" }, + "selection": { "$ref": "#/$defs/selection" }, + "state": { "$ref": "#/$defs/state" }, + "key": { "type": "string" }, + "count": { + "oneOf": [ + { "type": "integer", "minimum": 1 }, + { "type": "null" } + ] + }, + "input_packet_indexes": { + "type": "array", + "items": { "type": "integer", "minimum": 0 } + }, + "time_value_indexes": { + "type": "array", + "items": { "type": "integer", "minimum": 0 } + } + } + }, + "action_outcome": { + "type": "object", + "required": ["after_step", "kind", "position", "complete", "successful_steps"], + "additionalProperties": false, + "properties": { + "after_step": { "type": "integer", "minimum": 0 }, + "kind": { + "enum": ["movement", "neutral", "escape", "failed_search", "error", "empty"] + }, + "position": { "$ref": "#/$defs/position" }, + "complete": { + "oneOf": [ + { "type": "boolean" }, + { "type": "null" } + ] + }, + "successful_steps": { "type": "integer", "minimum": 0 }, + "effective_descriptor": { + "oneOf": [ + { "enum": ["f", "F", "t", "T"] }, + { "type": "null" } + ] + }, + "buffer_lines": { + "type": "array", + "items": { "type": "string" } + }, + "dot_payload": { + "type": "object", + "required": ["descriptor", "target"], + "additionalProperties": false, + "properties": { + "descriptor": { "enum": ["f", "F", "t", "T"] }, + "target": { "$ref": "#/$defs/target" } + } + } + } + }, + "state_snapshot": { + "type": "object", + "required": ["after_step", "state", "retained_fields", "cleared_fields"], + "additionalProperties": false, + "properties": { + "after_step": { "type": "integer", "minimum": 0 }, + "state": { "$ref": "#/$defs/state" }, + "retained_fields": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true + }, + "cleared_fields": { + "type": "array", + "items": { "type": "string" }, + "uniqueItems": true + } + } + }, + "overlay_plan": { + "type": "object", + "required": ["after_step", "operation", "group", "identity"], + "additionalProperties": false, + "properties": { + "after_step": { "type": "integer", "minimum": 0 }, + "operation": { "enum": ["create", "remove", "rebuild", "preserve"] }, + "group": { "enum": ["CleverFCursor", "CleverFChar", "CleverFDirect"] }, + "identity": { "type": "string" }, + "window": { "type": "string" }, + "anchor_line": { "type": "integer", "minimum": 1 }, + "positions": { + "type": "array", + "items": { "$ref": "#/$defs/position" } + }, + "priority": { "enum": ["ordinary", "high"] }, + "descriptor": { "enum": ["f", "F", "t", "T"] }, + "target_plan": { "type": "string" } + } + }, + "timer_operation": { + "type": "object", + "required": ["after_step", "operation", "identity"], + "additionalProperties": false, + "properties": { + "after_step": { "type": "integer", "minimum": 0 }, + "operation": { "enum": ["start", "stop", "fire", "ignore", "set_inactive"] }, + "identity": { "type": "string" }, + "delay_ms": { "type": "integer", "minimum": 0 } + } + }, + "redraw": { + "type": "object", + "required": ["after_step", "kind"], + "additionalProperties": false, + "properties": { + "after_step": { "type": "integer", "minimum": 0 }, + "kind": { "enum": ["screen", "full", "suppressed"] } + } + }, + "diagnostic": { + "type": "object", + "required": ["after_step", "level", "text"], + "additionalProperties": false, + "properties": { + "after_step": { "type": "integer", "minimum": 0 }, + "level": { "enum": ["error", "warning", "info"] }, + "text": { "type": "string" } + } + }, + "host_operation": { + "type": "object", + "required": ["after_step", "operation"], + "additionalProperties": false, + "properties": { + "after_step": { "type": "integer", "minimum": 0 }, + "operation": { + "enum": [ + "open_fold", + "apply_cursor", + "apply_selection", + "read_input", + "hide_cursor_presentation", + "restore_cursor_presentation", + "register_finalizer", + "remove_finalizer" + ] + }, + "identity": { "type": "string" }, + "position": { "$ref": "#/$defs/position" }, + "fold_level": { "type": "integer", "minimum": 1 } + } + }, + "scenario": { + "type": "object", + "required": [ + "id", + "title", + "source_refs", + "requirements", + "given", + "steps", + "expect" + ], + "additionalProperties": false, + "properties": { + "id": { "type": "string", "pattern": "^SCN-[0-9]{4}-[A-Z0-9-]+$" }, + "title": { "type": "string" }, + "source_refs": { + "type": "array", + "items": { "type": "string" }, + "minItems": 1, + "uniqueItems": true + }, + "requirements": { + "type": "array", + "items": { "type": "string", "pattern": "^CF-[0-9]{4}-[0-9]{3}$" }, + "minItems": 1, + "uniqueItems": true + }, + "given": { + "type": "object", + "required": [ + "buffer", + "effective_encoding", + "cursor", + "mode", + "selection", + "pending_operator", + "count", + "configuration", + "input_packets", + "time_values_ms", + "events", + "state", + "host" + ], + "additionalProperties": false, + "properties": { + "buffer": { + "type": "object", + "required": ["lines"], + "additionalProperties": false, + "properties": { + "lines": { + "type": "array", + "items": { "type": "string" }, + "minItems": 1 + } + } + }, + "effective_encoding": { "type": "string" }, + "cursor": { "$ref": "#/$defs/position" }, + "mode": { "type": "string", "minLength": 1 }, + "selection": { "$ref": "#/$defs/selection" }, + "pending_operator": { + "oneOf": [ + { "type": "string" }, + { "type": "null" } + ] + }, + "count": { + "oneOf": [ + { "type": "integer", "minimum": 1 }, + { "type": "null" } + ] + }, + "configuration": { + "type": "object", + "additionalProperties": { "$ref": "#/$defs/configuration_value" } + }, + "input_packets": { + "type": "array", + "items": { "$ref": "#/$defs/input_packet" } + }, + "time_values_ms": { + "type": "array", + "items": { "type": "number" } + }, + "events": { + "type": "array", + "items": { "$ref": "#/$defs/event" } + }, + "state": { "$ref": "#/$defs/state" }, + "host": { + "type": "object", + "required": ["macro_register", "fold_open_policy", "closed_fold_levels", "timer_support", "cmdline_cursor_support"], + "additionalProperties": false, + "properties": { + "macro_register": { + "oneOf": [ + { "type": "string" }, + { "type": "null" } + ] + }, + "fold_open_policy": { + "type": "array", + "items": { "enum": ["all", "horizontal", "vertical", "block", "insert", "jump", "mark", "percent", "quickfix", "search", "tag", "undo"] }, + "uniqueItems": true + }, + "closed_fold_levels": { "type": "integer", "minimum": 0 }, + "timer_support": { "type": "boolean" }, + "cmdline_cursor_support": { "type": "boolean" } + } + } + } + }, + "steps": { + "type": "array", + "items": { "$ref": "#/$defs/action_step" }, + "minItems": 1 + }, + "expect": { + "type": "object", + "required": [ + "action_outcomes", + "final_buffer", + "final_position", + "final_selection", + "state_snapshots", + "overlay_plans", + "timer_operations", + "prompts", + "redraws", + "diagnostics", + "host_operations" + ], + "additionalProperties": false, + "properties": { + "action_outcomes": { + "type": "array", + "items": { "$ref": "#/$defs/action_outcome" } + }, + "final_buffer": { + "type": "array", + "items": { "type": "string" }, + "minItems": 1 + }, + "final_position": { "$ref": "#/$defs/position" }, + "final_selection": { "$ref": "#/$defs/selection" }, + "state_snapshots": { + "type": "array", + "items": { "$ref": "#/$defs/state_snapshot" } + }, + "overlay_plans": { + "type": "array", + "items": { "$ref": "#/$defs/overlay_plan" } + }, + "timer_operations": { + "type": "array", + "items": { "$ref": "#/$defs/timer_operation" } + }, + "prompts": { + "type": "array", + "items": { "type": "string" } + }, + "redraws": { + "type": "array", + "items": { "$ref": "#/$defs/redraw" } + }, + "diagnostics": { + "type": "array", + "items": { "$ref": "#/$defs/diagnostic" } + }, + "host_operations": { + "type": "array", + "items": { "$ref": "#/$defs/host_operation" } + } + } + } + } + } + } +} |
