-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix test for extends not at top level and ensure second extends alway…
…s triggers an early exception (#2791)
- Loading branch information
1 parent
5c704b2
commit df7d661
Showing
7 changed files
with
24 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
extends default | ||
extends default |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const pug = require('../../'); | ||
|
||
// regression test for #2404 | ||
|
||
test('extends not top level should throw an error', () => { | ||
expect( | ||
() => pug.compileFile( | ||
__dirname + '/index.pug' | ||
) | ||
).toThrow('Declaration of template inheritance ("extends") should be the first thing in the file. There can only be one extends statement per file.'); | ||
}); | ||
|
||
test('duplicate extends should throw an error', () => { | ||
expect( | ||
() => pug.compileFile( | ||
__dirname + '/duplicate.pug' | ||
) | ||
).toThrow('Declaration of template inheritance ("extends") should be the first thing in the file. There can only be one extends statement per file.'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters