Migrate upb/rust to gtest

PiperOrigin-RevId: 672974055
pull/18207/head
Derek Benson 3 months ago committed by Copybara-Service
parent 0b98d419fa
commit 0f4bfc4eac
  1. 3
      rust/upb/BUILD
  2. 7
      rust/upb/arena.rs
  3. 5
      rust/upb/array.rs
  4. 5
      rust/upb/map.rs
  5. 3
      rust/upb/message.rs
  6. 3
      rust/upb/mini_table.rs
  7. 7
      rust/upb/owned_arena_box.rs
  8. 3
      rust/upb/text.rs
  9. 3
      rust/upb/wire.rs

@ -39,6 +39,9 @@ rust_library(
rust_test(
name = "upb_rs_crate_test",
crate = ":upb",
deps = [
"@crate_index//:googletest",
],
)
cc_library(

@ -204,8 +204,9 @@ extern "C" {
#[cfg(test)]
mod tests {
use super::*;
use googletest::gtest;
#[test]
#[gtest]
fn assert_arena_linked() {
use super::super::assert_linked;
assert_linked!(upb_Arena_New);
@ -214,7 +215,7 @@ mod tests {
assert_linked!(upb_Arena_Fuse);
}
#[test]
#[gtest]
fn raw_ffi_test() {
// SAFETY: FFI unit test uses C API under expected patterns.
unsafe {
@ -225,7 +226,7 @@ mod tests {
}
}
#[test]
#[gtest]
fn test_arena_new_and_free() {
let arena = Arena::new();
drop(arena);

@ -29,8 +29,9 @@ extern "C" {
mod tests {
use super::super::Arena;
use super::*;
use googletest::gtest;
#[test]
#[gtest]
fn assert_array_linked() {
use super::super::assert_linked;
assert_linked!(upb_Array_New);
@ -45,7 +46,7 @@ mod tests {
assert_linked!(upb_Array_GetMutable);
}
#[test]
#[gtest]
fn array_ffi_test() {
// SAFETY: FFI unit test uses C API under expected patterns.
unsafe {

@ -51,8 +51,9 @@ extern "C" {
mod tests {
use super::super::Arena;
use super::*;
use googletest::gtest;
#[test]
#[gtest]
fn assert_map_linked() {
use super::super::assert_linked;
assert_linked!(upb_Map_New);
@ -64,7 +65,7 @@ mod tests {
assert_linked!(upb_Map_Next);
}
#[test]
#[gtest]
fn map_ffi_test() {
// SAFETY: FFI unit test uses C API under expected patterns.
unsafe {

@ -306,8 +306,9 @@ extern "C" {
#[cfg(test)]
mod tests {
use super::*;
use googletest::gtest;
#[test]
#[gtest]
fn assert_message_linked() {
use super::super::assert_linked;
assert_linked!(upb_Message_New);

@ -50,8 +50,9 @@ extern "C" {
#[cfg(test)]
mod tests {
use super::*;
use googletest::gtest;
#[test]
#[gtest]
fn assert_mini_table_linked() {
use super::super::assert_linked;
assert_linked!(upb_MiniTable_FindFieldByNumber);

@ -88,8 +88,9 @@ impl<T: Debug + 'static> Debug for OwnedArenaBox<T> {
mod tests {
use super::*;
use core::str;
use googletest::gtest;
#[test]
#[gtest]
fn test_byte_slice_pointer_roundtrip() {
let arena = Arena::new();
let original_data: &'static [u8] = b"Hello world";
@ -97,7 +98,7 @@ mod tests {
assert_eq!(&*owned_data, b"Hello world");
}
#[test]
#[gtest]
fn test_alloc_str_roundtrip() {
let arena = Arena::new();
let s: &str = "Hello";
@ -106,7 +107,7 @@ mod tests {
assert_eq!(&*owned_data, s);
}
#[test]
#[gtest]
fn test_sized_type_roundtrip() {
let arena = Arena::new();
let arena_alloc_u32: NonNull<u32> = arena.copy_in(&7u32).unwrap().into();

@ -68,8 +68,9 @@ pub unsafe fn debug_string(msg: RawMessage, mt: *const upb_MiniTable) -> String
#[cfg(test)]
mod tests {
use super::*;
use googletest::gtest;
#[test]
#[gtest]
fn assert_text_linked() {
use super::super::assert_linked;
assert_linked!(upb_DebugString);

@ -126,8 +126,9 @@ extern "C" {
#[cfg(test)]
mod tests {
use super::*;
use googletest::gtest;
#[test]
#[gtest]
fn assert_wire_linked() {
use super::super::assert_linked;
assert_linked!(upb_Encode);

Loading…
Cancel
Save