@@ -205,3 +205,150 @@ public void OnlySeesGlobalVariable() =>
205205 Html . Should ( ) . NotContain ( "title=\" {{hello-world}}\" " )
206206 . And . Contain ( "title=\" Hello World\" " ) ;
207207}
208+
209+ public class MutationOperatorTest ( ITestOutputHelper output ) : InlineTest ( output ,
210+ """
211+ ---
212+ sub:
213+ version: "9.0.4"
214+ ---
215+
216+ # Testing Mutation Operators
217+
218+ Version: {{version|M.M}}
219+ Version with space: {{version | M.M}}
220+ Major only: {{version|M}}
221+ Major only with space: {{version | M}}
222+ Major.x: {{version|M.x}}
223+ Major.x with space: {{version | M.x}}
224+ Increase major: {{version|M+1}}
225+ Increase major with space: {{version | M+1}}
226+ Increase minor: {{version|M.M+1}}
227+ Increase minor with space: {{version | M.M+1}}
228+ """
229+ )
230+ {
231+ [ Fact ]
232+ public void MutationOperatorsWorkWithAndWithoutSpaces ( )
233+ {
234+ // Both versions with and without spaces should render the same way
235+ Html . Should ( ) . Contain ( "Version: 9.0" )
236+ . And . Contain ( "Version with space: 9.0" )
237+ . And . Contain ( "Major only: 9" )
238+ . And . Contain ( "Major only with space: 9" )
239+ . And . Contain ( "Major.x: 9.x" )
240+ . And . Contain ( "Major.x with space: 9.x" )
241+ . And . Contain ( "Increase major: 10.0.0" )
242+ . And . Contain ( "Increase major with space: 10.0.0" )
243+ . And . Contain ( "Increase minor: 9.1.0" )
244+ . And . Contain ( "Increase minor with space: 9.1.0" ) ;
245+ }
246+
247+ [ Fact ]
248+ public void HasNoErrors ( ) => Collector . Diagnostics . Should ( ) . HaveCount ( 0 ) ;
249+ }
250+
251+ public class MultipleMutationOperatorsTest ( ITestOutputHelper output ) : InlineTest ( output ,
252+ """
253+ ---
254+ sub:
255+ version: "9.0.4"
256+ product: "Elasticsearch"
257+ ---
258+
259+ # Testing Multiple Mutation Operators
260+
261+ Version: {{version|M.M|lc}}
262+ Version with spaces: {{version | M.M | lc}}
263+ Product: {{product|uc}}
264+ Product with spaces: {{product | uc}}
265+ """
266+ )
267+ {
268+ [ Fact ]
269+ public void MultipleMutationOperatorsWorkWithAndWithoutSpaces ( )
270+ {
271+ // Both versions with and without spaces should render the same way
272+ Html . Should ( ) . Contain ( "Version: 9.0" )
273+ . And . Contain ( "Version with spaces: 9.0" )
274+ . And . Contain ( "Product: ELASTICSEARCH" )
275+ . And . Contain ( "Product with spaces: ELASTICSEARCH" ) ;
276+ }
277+
278+ [ Fact ]
279+ public void HasNoErrors ( ) => Collector . Diagnostics . Should ( ) . HaveCount ( 0 ) ;
280+ }
281+
282+ public class MutationOperatorsInLinksTest ( ITestOutputHelper output ) : InlineTest ( output ,
283+ """
284+ ---
285+ sub:
286+ version: "9.0.4"
287+ product: "Elasticsearch"
288+ ---
289+
290+ # Testing Mutation Operators in Links
291+
292+ [Link with mutation operator](https://www.elastic.co/guide/en/elasticsearch/reference/{{version|M.M}}/index.html)
293+ [Link with mutation operator and space](https://www.elastic.co/guide/en/elasticsearch/reference/{{version | M.M}}/index.html)
294+ [Link text with mutation]({{product|uc}} {{version|M.M}})
295+ [Link text with mutation and space]({{product | uc}} {{version | M.M}})
296+
297+ """
298+ )
299+ {
300+ [ Fact ]
301+ public void MutationOperatorsWorkInLinks ( )
302+ {
303+ // Check URL mutations
304+ Html . Should ( ) . Contain ( "href=\" https://www.elastic.co/guide/en/elasticsearch/reference/9.0/index.html\" " )
305+ . And . NotContain ( "{{version|M.M}}" )
306+ . And . NotContain ( "{{version | M.M}}" ) ;
307+
308+ // Check link text mutations
309+ Html . Should ( ) . Contain ( "ELASTICSEARCH 9.0" )
310+ . And . NotContain ( "{{product|uc}}" )
311+ . And . NotContain ( "{{version|M.M}}" ) ;
312+
313+ // Check link text mutations with spaces
314+ Html . Should ( ) . Contain ( "ELASTICSEARCH 9.0" )
315+ . And . NotContain ( "{{product | uc}}" )
316+ . And . NotContain ( "{{version | M.M}}" ) ;
317+ }
318+
319+ [ Fact ]
320+ public void HasNoErrors ( ) => Collector . Diagnostics . Should ( ) . HaveCount ( 0 ) ;
321+ }
322+
323+ public class MutationOperatorsInCodeBlocksTest ( ITestOutputHelper output ) : BlockTest < EnhancedCodeBlock > ( output ,
324+ """
325+ ---
326+ sub:
327+ version: "9.0.4"
328+ product: "Elasticsearch"
329+ ---
330+
331+ # Testing Mutation Operators in Code Blocks
332+
333+ ```{code} sh subs=true
334+ # Install Elasticsearch {{version|M.M}}
335+ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{{version|M.M}}-linux-x86_64.tar.gz
336+
337+ # With space in mutation
338+ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{{version | M.M}}-linux-x86_64.tar.gz
339+ ```
340+ """
341+ )
342+ {
343+ [ Fact ]
344+ public void MutationOperatorsWorkInCodeBlocks ( )
345+ {
346+ Html . Should ( ) . Contain ( "# Install Elasticsearch 9.0" )
347+ . And . Contain ( "elasticsearch-9.0-linux-x86_64.tar.gz" )
348+ . And . NotContain ( "{{version|M.M}}" )
349+ . And . NotContain ( "{{version | M.M}}" ) ;
350+ }
351+
352+ [ Fact ]
353+ public void HasNoErrors ( ) => Collector . Diagnostics . Should ( ) . HaveCount ( 0 ) ;
354+ }
0 commit comments