From db0e71f10a157c211863ac844ceb0572967df298 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Sat, 9 Aug 2014 09:59:47 +0200 Subject: [PATCH] pretty printer: Added some `run-make` tests of path-suffix lookup functionality. --- .../pretty-print-path-suffix/Makefile | 9 ++++++ .../run-make/pretty-print-path-suffix/foo.pp | 15 ++++++++++ .../pretty-print-path-suffix/foo_method.pp | 16 +++++++++++ .../pretty-print-path-suffix/input.rs | 28 +++++++++++++++++++ .../pretty-print-path-suffix/nest_foo.pp | 14 ++++++++++ 5 files changed, 82 insertions(+) create mode 100644 src/test/run-make/pretty-print-path-suffix/Makefile create mode 100644 src/test/run-make/pretty-print-path-suffix/foo.pp create mode 100644 src/test/run-make/pretty-print-path-suffix/foo_method.pp create mode 100644 src/test/run-make/pretty-print-path-suffix/input.rs create mode 100644 src/test/run-make/pretty-print-path-suffix/nest_foo.pp diff --git a/src/test/run-make/pretty-print-path-suffix/Makefile b/src/test/run-make/pretty-print-path-suffix/Makefile new file mode 100644 index 00000000000..f58a6527ac6 --- /dev/null +++ b/src/test/run-make/pretty-print-path-suffix/Makefile @@ -0,0 +1,9 @@ +-include ../tools.mk + +all: + $(RUSTC) -o $(TMPDIR)/foo.out --pretty normal=foo input.rs + $(RUSTC) -o $(TMPDIR)/nest_foo.out --pretty normal=nest::foo input.rs + $(RUSTC) -o $(TMPDIR)/foo_method.out --pretty normal=foo_method input.rs + diff -u $(TMPDIR)/foo.out foo.pp + diff -u $(TMPDIR)/nest_foo.out nest_foo.pp + diff -u $(TMPDIR)/foo_method.out foo_method.pp diff --git a/src/test/run-make/pretty-print-path-suffix/foo.pp b/src/test/run-make/pretty-print-path-suffix/foo.pp new file mode 100644 index 00000000000..f3130a8044a --- /dev/null +++ b/src/test/run-make/pretty-print-path-suffix/foo.pp @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +pub fn foo() -> i32 { 45 } /* foo */ + + +pub fn foo() -> &'static str { "i am a foo." } /* nest::foo */ diff --git a/src/test/run-make/pretty-print-path-suffix/foo_method.pp b/src/test/run-make/pretty-print-path-suffix/foo_method.pp new file mode 100644 index 00000000000..acf3f90cb0e --- /dev/null +++ b/src/test/run-make/pretty-print-path-suffix/foo_method.pp @@ -0,0 +1,16 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + + + + +fn foo_method(&self) -> &'static str { return "i am very similiar to foo."; } +/* nest::S::foo_method */ diff --git a/src/test/run-make/pretty-print-path-suffix/input.rs b/src/test/run-make/pretty-print-path-suffix/input.rs new file mode 100644 index 00000000000..4942540126b --- /dev/null +++ b/src/test/run-make/pretty-print-path-suffix/input.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +pub fn +foo() -> i32 +{ 45 } + +pub fn bar() -> &'static str { "i am not a foo." } + +pub mod nest { + pub fn foo() -> &'static str { "i am a foo." } + + struct S; + impl S { + fn foo_method(&self) -> &'static str { + return "i am very similiar to foo."; + } + } +} diff --git a/src/test/run-make/pretty-print-path-suffix/nest_foo.pp b/src/test/run-make/pretty-print-path-suffix/nest_foo.pp new file mode 100644 index 00000000000..88eaa062b03 --- /dev/null +++ b/src/test/run-make/pretty-print-path-suffix/nest_foo.pp @@ -0,0 +1,14 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + + + +pub fn foo() -> &'static str { "i am a foo." } /* nest::foo */