@@ -14,6 +14,12 @@ const distRoot = path.resolve(docsRoot, '.vitepress', 'dist')
1414
1515const cachedLandingPages = new Map ( )
1616
17+ function extractLandingHeroSection ( html ) {
18+ const heroMatch = html . match ( / < s e c t i o n c l a s s = " l a n d i n g - h e r o " [ \s \S ] * ?< \/ s e c t i o n > / )
19+ assert . ok ( heroMatch , 'expected built homepage LandingHero section' )
20+ return heroMatch [ 0 ]
21+ }
22+
1723function readBuiltLandingPages ( base = '/cpp-high-performance-guide/' ) {
1824 if ( ! cachedLandingPages . has ( base ) ) {
1925 const result = spawnSync ( process . execPath , [ buildPagesScriptPath ] , {
@@ -58,6 +64,8 @@ test('build:pages uses a cross-platform Node wrapper while preserving external b
5864
5965test ( 'build:pages prefixes homepage landing links with the GitHub Pages base and .html leaf routes' , ( ) => {
6066 const { en, zh } = readBuiltLandingPages ( )
67+ const enHero = extractLandingHeroSection ( en )
68+ const zhHero = extractLandingHeroSection ( zh )
6169
6270 for ( const href of [
6371 '/cpp-high-performance-guide/en/reference/' ,
@@ -81,6 +89,20 @@ test('build:pages prefixes homepage landing links with the GitHub Pages base and
8189 assert . match ( zh , new RegExp ( `href="${ href . replaceAll ( '/' , '\\/' ) } "` ) )
8290 }
8391
92+ assert . match ( enHero , / h r e f = " \/ c p p - h i g h - p e r f o r m a n c e - g u i d e \/ e n \/ g e t t i n g - s t a r t e d \/ q u i c k s t a r t (?: \. h t m l ) ? " / )
93+ assert . match ( enHero , / h r e f = " \/ c p p - h i g h - p e r f o r m a n c e - g u i d e \/ e n \/ a c a d e m y \/ " / )
94+ assert . match ( enHero , / h r e f = " \/ c p p - h i g h - p e r f o r m a n c e - g u i d e \/ e n \/ a c a d e m y \/ m o d u l e - a t l a s (?: \. h t m l ) ? " / )
95+ assert . match ( enHero , / h r e f = " \/ c p p - h i g h - p e r f o r m a n c e - g u i d e \/ e n \/ a c a d e m y \/ v a l i d a t i o n - d o c t r i n e (?: \. h t m l ) ? " / )
96+ assert . match ( enHero , / h r e f = " \/ c p p - h i g h - p e r f o r m a n c e - g u i d e \/ e n \/ a r c h i t e c t u r e \/ p e r f o r m a n c e - m e t h o d o l o g y (?: \. h t m l ) ? " / )
97+ assert . doesNotMatch ( enHero , / h r e f = " \/ (?: e n | z h ) \/ / )
98+
99+ assert . match ( zhHero , / h r e f = " \/ c p p - h i g h - p e r f o r m a n c e - g u i d e \/ z h \/ g e t t i n g - s t a r t e d \/ q u i c k s t a r t (?: \. h t m l ) ? " / )
100+ assert . match ( zhHero , / h r e f = " \/ c p p - h i g h - p e r f o r m a n c e - g u i d e \/ z h \/ a c a d e m y \/ " / )
101+ assert . match ( zhHero , / h r e f = " \/ c p p - h i g h - p e r f o r m a n c e - g u i d e \/ z h \/ a c a d e m y \/ m o d u l e - a t l a s (?: \. h t m l ) ? " / )
102+ assert . match ( zhHero , / h r e f = " \/ c p p - h i g h - p e r f o r m a n c e - g u i d e \/ z h \/ a c a d e m y \/ v a l i d a t i o n - d o c t r i n e (?: \. h t m l ) ? " / )
103+ assert . match ( zhHero , / h r e f = " \/ c p p - h i g h - p e r f o r m a n c e - g u i d e \/ z h \/ a r c h i t e c t u r e \/ p e r f o r m a n c e - m e t h o d o l o g y (?: \. h t m l ) ? " / )
104+ assert . doesNotMatch ( zhHero , / h r e f = " \/ (?: e n | z h ) \/ / )
105+
84106 for ( const rawHref of [
85107 'href="/en/reference/"' ,
86108 'href="/en/getting-started/quickstart"' ,
0 commit comments