diff options
author | Nadrieril | 2020-05-30 15:05:36 +0100 |
---|---|---|
committer | Nadrieril | 2020-05-30 15:06:30 +0100 |
commit | a35de29355dc85f63e0e8514a2e447bf5322ba20 (patch) | |
tree | 9eec496ad246e2831d42291d6078c84c8a73879f /dhall/src/syntax/text/parser.rs | |
parent | 97e46bef0fe1729d5de0a9a40ba939842023fea7 (diff) |
Commit grammar file locally
The crate publishing process does not allow access to files outside the
current crate.
Diffstat (limited to 'dhall/src/syntax/text/parser.rs')
-rw-r--r-- | dhall/src/syntax/text/parser.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/dhall/src/syntax/text/parser.rs b/dhall/src/syntax/text/parser.rs index dcaf5e4..486030f 100644 --- a/dhall/src/syntax/text/parser.rs +++ b/dhall/src/syntax/text/parser.rs @@ -1063,3 +1063,32 @@ pub fn parse_expr(input_str: &str) -> ParseResult<Expr> { [expression(e)] => e, )) } + +#[test] +// Check that the local copy of the grammar file is in sync with the one from dhall-lang. +fn test_grammar_files_in_sync() { + use std::process::Command; + + let spec_abnf_path = "../dhall-lang/standard/dhall.abnf"; + let local_abnf_path = "src/syntax/text/dhall.abnf"; + + let out = Command::new("git") + .arg("diff") + .arg("--no-index") + .arg("--ignore-space-change") + .arg("--color") + .arg("--") + .arg(spec_abnf_path) + .arg(local_abnf_path) + .output() + .expect("failed to run `git diff` command"); + + if !out.status.success() { + let output = String::from_utf8_lossy(&out.stdout); + panic!( + "The local dhall.abnf file differs from the one from \ + dhall-lang!\n{}", + output + ); + } +} |