@@ -22,7 +22,7 @@ not a comment
2222{
2323
2424 [ Fact ]
25- public void GeneratesAttributesInHtml ( ) =>
25+ public void ReplacesSubsFromFrontMatter ( ) =>
2626 Html . Should ( ) . Contain (
2727 """Hello World!<br />"""
2828 ) . And . Contain (
@@ -48,7 +48,7 @@ not a {substitution}
4848{
4949
5050 [ Fact ]
51- public void GeneratesAttributesInHtml ( ) =>
51+ public void PreservesSingleBracket ( ) =>
5252 Html . Should ( ) . Contain (
5353 """Hello World!<br />"""
5454 ) . And . Contain (
@@ -87,3 +87,49 @@ public void ReplacesSubsInCode() =>
8787 Html . Should ( ) . Contain ( "7.17.0" ) ;
8888}
8989
90+
91+ public class SupportsSubstitutionsFromDocSet ( ITestOutputHelper output ) : InlineTest ( output ,
92+ """
93+ ---
94+ sub:
95+ hello-world: "Hello World!"
96+ ---
97+ The following should be subbed: {{hello-world}}
98+ The following should be subbed as well: {{global-var}}
99+ """
100+ , new ( ) { { "global-var" , "A variable from docset.yml" } }
101+ )
102+ {
103+
104+ [ Fact ]
105+ public void EmitsGlobalVariable ( ) =>
106+ Html . Should ( ) . Contain ( "Hello World!<br />" )
107+ . And . NotContain ( "{{hello-world}}" )
108+ . And . Contain ( "A variable from docset.yml" )
109+ . And . NotContain ( "{{global-var}}" ) ;
110+ }
111+
112+
113+ public class CanNotShadeGlobalVariables ( ITestOutputHelper output ) : InlineTest ( output ,
114+ """
115+ ---
116+ sub:
117+ hello-world: "Hello World!"
118+ ---
119+ The following should be subbed: {{hello-world}}
120+ The following should be subbed as well: {{hello-world}}
121+ """
122+ , new ( ) { { "hello-world" , "A variable from docset.yml" } }
123+ )
124+ {
125+
126+ [ Fact ]
127+ public void OnlySeesGlobalVariable ( ) =>
128+ Html . Should ( ) . NotContain ( "Hello World!<br />" )
129+ . And . NotContain ( "{{hello-world}}" )
130+ . And . Contain ( "A variable from docset.yml" ) ;
131+
132+ [ Fact ]
133+ public void HasError ( ) => Collector . Diagnostics . Should ( ) . HaveCount ( 1 )
134+ . And . Contain ( d => d . Message . Contains ( "{hello-world} can not be redeclared in front matter as its a global substitution" ) ) ;
135+ }
0 commit comments