Skip to content

Commit e4b3fac

Browse files
committed
Added a test for include_bytes! dep info
This tests that both include_str! and include_bytes! mark their input file as a dependancy, and it's correctly outputted when you run `rustc --emit dep-info`.
1 parent 9f481b8 commit e4b3fac

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-include ../tools.mk
2+
3+
# FIXME: ignore freebsd/windows
4+
# on windows `rustc --dep-info` produces Makefile dependency with
5+
# windows native paths (e.g. `c:\path\to\libfoo.a`)
6+
# but msys make seems to fail to recognize such paths, so test fails.
7+
ifneq ($(shell uname),FreeBSD)
8+
ifndef IS_WINDOWS
9+
all:
10+
$(RUSTC) --emit dep-info main.rs
11+
grep "input.txt" $(TMPDIR)/main.d
12+
grep "input.bin" $(TMPDIR)/main.d
13+
else
14+
all:
15+
16+
endif
17+
18+
else
19+
all:
20+
21+
endif
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello world!
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello world!
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub fn main() {
12+
const INPUT_TXT: &'static str = include_str!("input.txt");
13+
const INPUT_BIN: &'static [u8] = include_bytes!("input.bin");
14+
15+
println!("{}", INPUT_TXT);
16+
println!("{:?}", INPUT_BIN);
17+
}

0 commit comments

Comments
 (0)