Skip to content

Commit 7d93c57

Browse files
Merge pull request google#566 from carlwhamilton:no_std
PiperOrigin-RevId: 727752061
2 parents 25be671 + 7ca2fb5 commit 7d93c57

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

googletest/tests/no_std_test.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2025 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#![no_std]
16+
17+
/// A simple, no_std function.
18+
fn no_std_identity(value: u32) -> u32 {
19+
value
20+
}
21+
22+
#[cfg(test)]
23+
mod tests {
24+
use super::*;
25+
use googletest::prelude::*;
26+
27+
#[gtest]
28+
fn no_std_verify() -> Result<()> {
29+
verify_eq!(no_std_identity(42), 42)?;
30+
Ok(())
31+
}
32+
33+
#[gtest]
34+
fn no_std_expect() {
35+
expect_eq!(no_std_identity(214), 214)
36+
}
37+
}

googletest_macro/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ pub fn gtest(
105105
.unwrap_or_else(||
106106
(
107107
quote! {Ok(())},
108-
quote! { ::std::result::Result<(), googletest::internal::test_outcome::TestFailure> },
108+
quote! { ::core::result::Result<(), googletest::internal::test_outcome::TestFailure> },
109109
quote! {},
110110
));
111111

0 commit comments

Comments
 (0)