tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

main.rs (1392B)


      1 // Copyright 2021 The Chromium Authors
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 chromium::import! {
      6    "//chromium/build/rust/tests/test_rust_static_library";
      7    "//chromium/build/rust/tests/test_rust_static_library_non_standard_arrangement:lib" as
      8        test_rust_static_library_non_standard_arrangement;
      9 }
     10 
     11 // To mimic third-party, test_rlib_crate has a short crate_name which we do not
     12 // need to import!.
     13 use test_rlib_crate::say_hello_from_crate;
     14 
     15 fn main() {
     16    assert_eq!(test_proc_macro_crate::calculate_using_proc_macro!(), 30);
     17    assert_eq!(test_rust_static_library::add_two_ints_via_rust(3, 4), 7);
     18    assert_eq!(test_rust_static_library_non_standard_arrangement::do_subtract(4, 3), 1);
     19    say_hello_from_crate();
     20 }
     21 
     22 /// These tests are largely all to just test different permutations of builds,
     23 /// e.g. calling into mixed_static_librarys, crates, proc macros, etc.
     24 #[cfg(test)]
     25 mod tests {
     26    #[test]
     27    fn test_call_to_rust() {
     28        assert_eq!(test_rust_static_library::add_two_ints_via_rust(3, 4), 7);
     29    }
     30 
     31    #[test]
     32    fn test_call_to_rust_non_standard_arrangement() {
     33        assert_eq!(test_rust_static_library_non_standard_arrangement::do_subtract(8, 4), 4);
     34    }
     35 
     36    #[test]
     37    fn test_proc_macro() {
     38        assert_eq!(test_proc_macro_crate::calculate_using_proc_macro!(), 30)
     39    }
     40 }