1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# SAMPLE.toml — Reference for all supported spec suite definition fields.
#
# This file is not loaded by spec-diff. It documents every field the
# registry understands, when to use each one, and how they compose.
# Copy the pattern that matches your framework and fill in the data.
#
# CORE PRINCIPLE: This is a recognition engine. Only what you list is
# recognized. Unlisted AST patterns are ignored, not errored.
#
# CHOOSING THE RIGHT PATTERN:
#
# Does the framework use function-level markers (#[test], def test_)?
# -> Use "marker-based" spec detection
#
# Does the framework use DSL blocks (describe/it, test("name"))?
# -> Use "dsl-based" spec detection
#
# Does the framework use both (Go's func Test + t.Run)?
# -> Use "hybrid" with marker + nested DSL
#
# Does the framework have shared example definitions?
# -> Add a [shared] section
#
# Does the framework support parameterized tests?
# -> Add a [[parameterized]] section
#
# Does the framework support property-based testing?
# -> Add a [[property_based]] section
# ---------------------------------------------------------------
# FRAMEWORK IDENTITY
# ---------------------------------------------------------------
[[]]
= "example"
= "ruby" # tree-sitter grammar to use
= "tree-sitter-ruby"
= "Example framework"
# Optional: extend another framework definition
# extends = "rust_builtin"
# Optional: additional language support
# additional_languages = ["typescript"]
# additional_crates = ["tree-sitter-typescript"]
# ---------------------------------------------------------------
# FILE DETECTION
# ---------------------------------------------------------------
[]
= [".rb"]
= ["spec/**/*_spec.rb"]
= ["spec/spec_helper.rb"]
= false
# ---------------------------------------------------------------
# GROUP NODES
# ---------------------------------------------------------------
[[]]
= "call"
= ["describe", "context"]
= "first_argument"
= "string_literal"
# ---------------------------------------------------------------
# SPEC NODES
# ---------------------------------------------------------------
[[]]
= "call"
= ["it", "specify"]
= "first_argument"
= "string_literal"
= true
# ---------------------------------------------------------------
# MARKER-BASED DETECTION
# ---------------------------------------------------------------
# [[framework.marker]]
# marker_type = "attribute" # attribute | decorator | pragma | name_pattern
# marker_name = "test"
# marker_argument = "test" # for cfg(test)
# pattern = "^Test" # for name_pattern
# applies_to = "function" # function | method | class | module
# creates = "spec" # spec | group
# required_param_type = "*testing.T"
# ---------------------------------------------------------------
# NESTED DISCOVERY (hybrid frameworks)
# ---------------------------------------------------------------
# [[framework.nested_discovery]]
# parent = "marker"
# ast_type = "call_expression"
# receiver = "t"
# method_name = "Run"
# name_source = "first_argument"
# name_source_type = "string_literal"
# creates = "spec"
# ---------------------------------------------------------------
# TABLE-DRIVEN TESTS
# ---------------------------------------------------------------
# [framework.table_driven]
# enabled = true
# slice_pattern = "composite_literal"
# loop_pattern = "for_statement"
# run_call = "t.Run"
# ---------------------------------------------------------------
# NORMALIZATION
# ---------------------------------------------------------------
[]
= ["test_"]
= true
= false
= false
# ---------------------------------------------------------------
# FILE PATH GROUPING
# ---------------------------------------------------------------
[]
= ["spec/"]
= ["_spec"]
= "::"
= true
# ---------------------------------------------------------------
# PARAMETERIZED TESTS
# ---------------------------------------------------------------
# [[framework.parameterized]]
# detection = "decorator" # decorator | attribute | macro | method_call
# decorator_name = "pytest.mark.parametrize"
# attribute_name = "case"
# method_names = ["it.each"]
# case_count_source = "second_argument"
# case_count_type = "list_length" # list_length | attribute_count | array_length
# label_source = "ids_kwarg"
# label_fallback = "first_element"
# ---------------------------------------------------------------
# PROPERTY-BASED TESTS
# ---------------------------------------------------------------
# [[framework.property_based]]
# detection = "macro" # macro | decorator
# macro_name = "proptest"
# decorator_name = "given"
# decorator_module = "hypothesis"
# ---------------------------------------------------------------
# SHARED EXAMPLES
# ---------------------------------------------------------------
# [framework.shared]
# definition_globs = ["spec/support/**/*.rb"]
# scan_spec_files_for_definitions = true
# [[framework.shared.definition]]
# ast_type = "call"
# method_names = ["shared_examples"]
# name_source = "first_argument"
# name_source_type = "string_literal"
# body = "block"
# detection_strategy = "inheritance"
# handler = "pytest_inheritance"
# [[framework.shared.inclusion]]
# ast_type = "call"
# method_names = ["include_examples"]
# name_source = "first_argument"
# name_source_type = "string_literal"
# nesting = "inline" # inline | nested
# nested_name_template = "behaves like {name}"
# ---------------------------------------------------------------
# CUSTOM HANDLER (last resort)
# ---------------------------------------------------------------
# handler = "jest_dynamic"