Merge pull request #693 from rgrinberg/false-target

Add test to show that jbuilder mishandles ${null}
This commit is contained in:
Rudi Grinberg 2018-04-17 18:37:12 +07:00 committed by GitHub
commit 17cceaa992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 27 additions and 1 deletions

View File

@ -1061,7 +1061,11 @@ module Infer = struct
module Unexp = Make(Unexpanded.Uast)(S_unexp)(Outcome_unexp)(struct
open Outcome_unexp
let ( +@ ) acc fn = { acc with targets = fn :: acc.targets }
let ( +@ ) acc fn =
if SW.is_var fn ~name:"null" then
acc
else
{ acc with targets = fn :: acc.targets }
let ( +< ) acc _ = acc
let ( +<! )= ( +< )
end)

View File

@ -198,3 +198,8 @@ let to_string t =
|> String.concat ~sep:""
let sexp_of_t t = Sexp.To_sexp.string (to_string t)
let is_var t ~name =
match t.items with
| [Var (_, v)] -> v = name
| _ -> false

View File

@ -43,6 +43,8 @@ val iter : t -> f:(Loc.t -> string -> unit) -> unit
(** [iter t ~f] iterates [f] over all variables of [t], the text
portions being ignored. *)
val is_var : t -> name:string -> bool
module type EXPANSION = sig
type t
(** The value to which variables are expanded. *)

View File

@ -480,3 +480,12 @@
(run ${exe:cram.exe} run.t)
(diff? run.t run.t.corrected))))))
(alias
((name runtest)
(deps ((package jbuilder)
(files_recursively_in test-cases/null-dep)))
(action
(chdir test-cases/null-dep
(progn
(run ${exe:cram.exe} run.t)
(diff? run.t run.t.corrected))))))

View File

@ -0,0 +1,5 @@
(jbuild_version 1)
(alias
((name runtest)
(action (with-stdout-to ${null} (echo "hello world")))))

View File

@ -0,0 +1 @@
$ jbuilder runtest --debug-dependency-path