From eaeb51a96f3c050dc52180483d8753b2ea0101b5 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 21 Oct 2014 08:49:42 -0700 Subject: [PATCH] Don't open parser C file until code is generated --- spec/compiler/compile_examples.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/compiler/compile_examples.cc b/spec/compiler/compile_examples.cc index 004dcd51..87a239d0 100644 --- a/spec/compiler/compile_examples.cc +++ b/spec/compiler/compile_examples.cc @@ -23,8 +23,6 @@ describe("compiling the example grammars", []() { auto compile_grammar = [&](const Grammar &grammar, string language) { it(("compiles the " + language + " grammar").c_str(), [&]() { - ofstream file(example_parser_dir + language + ".c"); - auto result = compile(grammar, language); string code = get<0>(result); vector conflicts = get<1>(result); @@ -32,6 +30,7 @@ describe("compiling the example grammars", []() { AssertThat(error, Equals((GrammarError *)nullptr)); + ofstream file(example_parser_dir + language + ".c"); file << get<0>(result); file.close(); });