Skip to content

Commit

Permalink
Add preamble containing a @generated stanza
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Oct 3, 2022
1 parent e8bc7e0 commit 575b772
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions html5ever/src/tree_builder/generated.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This code is @generated. See tests/codegen.rs for more information.

use super::*;
use crate::tendril::SliceExt;
use crate::tokenizer::states::{Plaintext, Rawtext, Rcdata, ScriptData};
Expand Down
4 changes: 3 additions & 1 deletion html5ever/tests/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn generated_code_is_fresh() {
.stack_size(128 * 1024 * 1024)
.spawn(move || {
let generated = expand(&input);
let formatted = reformat(&generated);
let formatted = reformat(&format!("{}{}", PREAMBLE, generated));
let current = fs::read_to_string(&output).unwrap_or_default();

if formatted == current {
Expand Down Expand Up @@ -70,6 +70,8 @@ fn reformat(code: &str) -> String {
String::from_utf8(output.stdout).unwrap()
}

const PREAMBLE: &str = "// This code is @generated. See tests/codegen.rs for more information.\n\n";

/*
Implements the `match_token!()` macro for use by the HTML tree builder
Expand Down

0 comments on commit 575b772

Please sign in to comment.