authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-09-11 16:52:50-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-09-11 16:52:50-04:00
log15c67d2d50aae11dd425ad2629ebc9770fb95f30
treea65c5de1d635ca077d5d6473467bbaff7e1a91f4
parent4af844732a88393b172d33676732580b056910f6
signaturelock-open Commit is signed but in an unrecognized format.

fix docgen tests


2 files changed, 9 insertions(+), 0 deletions(-)

doc/docgen.zig+7
...@@ -11,6 +11,7 @@ const max_doc_file_size = 10 * 1024 * 1024;...@@ -11,6 +11,7 @@ const max_doc_file_size = 10 * 1024 * 1024;
11const exe_ext = std.build.Target(std.build.Target.Native).exeFileExt();11const exe_ext = std.build.Target(std.build.Target.Native).exeFileExt();
12const obj_ext = std.build.Target(std.build.Target.Native).oFileExt();12const obj_ext = std.build.Target(std.build.Target.Native).oFileExt();
13const tmp_dir_name = "docgen_tmp";13const tmp_dir_name = "docgen_tmp";
14const test_out_path = tmp_dir_name ++ os.path.sep_str ++ "test" ++ exe_ext;
1415
15pub fn main() !void {16pub fn main() !void {
16 var direct_allocator = std.heap.DirectAllocator.init();17 var direct_allocator = std.heap.DirectAllocator.init();
...@@ -821,6 +822,8 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var...@@ -821,6 +822,8 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
821 zig_exe,822 zig_exe,
822 "test",823 "test",
823 tmp_source_file_name,824 tmp_source_file_name,
825 "--output",
826 test_out_path,
824 });827 });
825 try out.print("<pre><code class=\"shell\">$ zig test {}.zig", code.name);828 try out.print("<pre><code class=\"shell\">$ zig test {}.zig", code.name);
826 switch (code.mode) {829 switch (code.mode) {
...@@ -863,6 +866,8 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var...@@ -863,6 +866,8 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
863 "--color",866 "--color",
864 "on",867 "on",
865 tmp_source_file_name,868 tmp_source_file_name,
869 "--output",
870 test_out_path,
866 });871 });
867 try out.print("<pre><code class=\"shell\">$ zig test {}.zig", code.name);872 try out.print("<pre><code class=\"shell\">$ zig test {}.zig", code.name);
868 switch (code.mode) {873 switch (code.mode) {
...@@ -918,6 +923,8 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var...@@ -918,6 +923,8 @@ fn genHtml(allocator: *mem.Allocator, tokenizer: *Tokenizer, toc: *Toc, out: var
918 zig_exe,923 zig_exe,
919 "test",924 "test",
920 tmp_source_file_name,925 tmp_source_file_name,
926 "--output",
927 test_out_path,
921 });928 });
922 switch (code.mode) {929 switch (code.mode) {
923 builtin.Mode.Debug => {},930 builtin.Mode.Debug => {},
src/codegen.cpp+2
...@@ -8122,6 +8122,8 @@ static void resolve_out_paths(CodeGen *g) {...@@ -8122,6 +8122,8 @@ static void resolve_out_paths(CodeGen *g) {
81228122
8123 if (g->enable_cache || g->out_type != OutTypeObj) {8123 if (g->enable_cache || g->out_type != OutTypeObj) {
8124 os_path_join(&g->artifact_dir, o_basename, &g->o_file_output_path);8124 os_path_join(&g->artifact_dir, o_basename, &g->o_file_output_path);
8125 } else if (g->wanted_output_file_path != nullptr && g->out_type == OutTypeObj) {
8126 buf_init_from_buf(&g->o_file_output_path, g->wanted_output_file_path);
8125 } else {8127 } else {
8126 buf_init_from_buf(&g->o_file_output_path, o_basename);8128 buf_init_from_buf(&g->o_file_output_path, o_basename);
8127 }8129 }