Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Created February 9, 2018 12:39
Show Gist options
  • Save nikomatsakis/dba5d97ea4876d43f7145d6ab82452d5 to your computer and use it in GitHub Desktop.
Save nikomatsakis/dba5d97ea4876d43f7145d6ab82452d5 to your computer and use it in GitHub Desktop.
#![feature(prelude_import)]
#![no_std]
// Copyright 2017 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 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags: --test
#![feature(termination_trait)]
#[prelude_import]
use std::prelude::v1::*;
#[macro_use]
extern crate std as std;
use std::num::ParseIntError;
#[test]
pub fn let_us_see() -> Result<(), ParseIntError> {
let _: u32 = "abc".parse()?;
Ok(())
}
pub mod __test_reexports {
pub use super::let_us_see;
}
pub mod __test {
extern crate test;
#[main]
pub fn main() -> () { test::test_main_static(TESTS) }
const TESTS: &'static [self::test::TestDescAndFn] =
&[self::test::TestDescAndFn{desc:
self::test::TestDesc{name:
self::test::StaticTestName("let_us_see"),
ignore: false,
should_panic:
self::test::ShouldPanic::No,
allow_fail:
false,},
testfn:
self::test::StaticTestFn({
fn secret_wrapper_name() {
let result =
::std::Termination::report(::__test_reexports::let_us_see());
{
match (&0,
&result)
{
(left_val,
right_val)
=>
{
if !(*left_val
==
*right_val)
{
{
::rt::begin_panic_fmt(&::std::fmt::Arguments::new_v1_formatted(&["assertion failed: `(left == right)`\n left: `",
"`,\n right: `",
"`"],
&match (&left_val,
&right_val)
{
(__arg0,
__arg1)
=>
[::std::fmt::ArgumentV1::new(__arg0,
::std::fmt::Debug::fmt),
::std::fmt::ArgumentV1::new(__arg1,
::std::fmt::Debug::fmt)],
},
&[::std::fmt::rt::v1::Argument{position:
::std::fmt::rt::v1::Position::At(0usize),
format:
::std::fmt::rt::v1::FormatSpec{fill:
' ',
align:
::std::fmt::rt::v1::Alignment::Unknown,
flags:
0u32,
precision:
::std::fmt::rt::v1::Count::Implied,
width:
::std::fmt::rt::v1::Count::Implied,},},
::std::fmt::rt::v1::Argument{position:
::std::fmt::rt::v1::Position::At(1usize),
format:
::std::fmt::rt::v1::FormatSpec{fill:
' ',
align:
::std::fmt::rt::v1::Alignment::Unknown,
flags:
0u32,
precision:
::std::fmt::rt::v1::Count::Implied,
width:
::std::fmt::rt::v1::Count::Implied,},}]),
&("termination-trait-in-test.rs",
1u32,
1u32))
}
}
}
}
};
}
secret_wrapper_name
}),}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment