-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Take into account
use
statements when resolving paths.
- Loading branch information
1 parent
6fe52d7
commit fa6a70f
Showing
36 changed files
with
787 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/cargo-kani/stubbing-do-not-resolve/other_crate1/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
fn mock() {} | ||
pub fn mock() {} |
2 changes: 1 addition & 1 deletion
2
tests/cargo-kani/stubbing-do-not-resolve/other_crate2/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
fn mock() {} | ||
pub fn mock() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tests/cargo-kani/stubbing-resolve-extern-crate-as/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright Kani Contributors | ||
# SPDX-License-Identifier: Apache-2.0 OR MIT | ||
[package] | ||
name = "stubbing-do-not-resolve" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
other_crate = { path = "other_crate" } | ||
|
||
[package.metadata.kani] | ||
flags = { enable-unstable=true, enable-stubbing=true } |
1 change: 1 addition & 0 deletions
1
tests/cargo-kani/stubbing-resolve-extern-crate-as/harness.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VERIFICATION:- SUCCESSFUL |
10 changes: 10 additions & 0 deletions
10
tests/cargo-kani/stubbing-resolve-extern-crate-as/other_crate/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright Kani Contributors | ||
# SPDX-License-Identifier: Apache-2.0 OR MIT | ||
[package] | ||
name = "other_crate" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
20 changes: 20 additions & 0 deletions
20
tests/cargo-kani/stubbing-resolve-extern-crate-as/other_crate/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
pub fn magic_number13() -> u32 { | ||
13 | ||
} | ||
|
||
pub mod inner_mod { | ||
pub fn magic_number42() -> u32 { | ||
42 | ||
} | ||
} | ||
|
||
pub struct MyType {} | ||
|
||
impl MyType { | ||
pub fn magic_number101() -> u32 { | ||
101 | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
tests/cargo-kani/stubbing-resolve-extern-crate-as/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
//! This tests whether we take into account `extern crate XXX as YYY;` | ||
//! statements when resolving paths in `kani::stub` attributes. | ||
extern crate other_crate as foo; | ||
|
||
#[kani::proof] | ||
#[kani::stub(zero, foo::magic_number13)] | ||
#[kani::stub(one, foo::inner_mod::magic_number42)] | ||
#[kani::stub(two, foo::MyType::magic_number101)] | ||
fn harness() { | ||
assert_eq!(zero(), foo::magic_number13()); | ||
assert_eq!(one(), foo::inner_mod::magic_number42()); | ||
assert_eq!(two(), foo::MyType::magic_number101()); | ||
} | ||
|
||
fn zero() -> u32 { | ||
0 | ||
} | ||
|
||
fn one() -> u32 { | ||
1 | ||
} | ||
|
||
fn two() -> u32 { | ||
2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copyright Kani Contributors | ||
# SPDX-License-Identifier: Apache-2.0 OR MIT | ||
[package] | ||
name = "stubbing-use-as-foreign" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
other_crate = { path = "other_crate" } | ||
|
||
[package.metadata.kani] | ||
flags = { enable-unstable=true, enable-stubbing=true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VERIFICATION:- SUCCESSFUL |
8 changes: 8 additions & 0 deletions
8
tests/cargo-kani/stubbing-use-as-foreign/other_crate/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright Kani Contributors | ||
# SPDX-License-Identifier: Apache-2.0 OR MIT | ||
[package] | ||
name = "other_crate" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] |
Oops, something went wrong.