renamed few tests

This commit is contained in:
delta17920 2026-02-04 03:35:11 +00:00
parent ddd8f92c8d
commit 158410457f
8 changed files with 103 additions and 65 deletions

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/3026
//@ run-pass
use std::collections::HashMap;

View file

@ -1,21 +1,34 @@
//! Regression test for https://github.com/rust-lang/rust/issues/3121
//@ run-pass
#![allow(dead_code)]
#![allow(non_camel_case_types)]
#[derive(Copy, Clone)]
enum side { mayo, catsup, vinegar }
enum side {
mayo,
catsup,
vinegar,
}
#[derive(Copy, Clone)]
enum order { hamburger, fries(side), shake }
enum order {
hamburger,
fries(side),
shake,
}
#[derive(Copy, Clone)]
enum meal { to_go(order), for_here(order) }
enum meal {
to_go(order),
for_here(order),
}
fn foo(m: Box<meal>, cond: bool) {
match *m {
meal::to_go(_) => { }
meal::for_here(_) if cond => {}
meal::for_here(order::hamburger) => {}
meal::for_here(order::fries(_s)) => {}
meal::for_here(order::shake) => {}
meal::to_go(_) => {}
meal::for_here(_) if cond => {}
meal::for_here(order::hamburger) => {}
meal::for_here(order::fries(_s)) => {}
meal::for_here(order::shake) => {}
}
}

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/3029
//@ run-fail
//@ error-pattern:so long
//@ needs-subprocess

View file

@ -1,60 +1,80 @@
//! Regression test for https://github.com/rust-lang/rust/issues/2904
//@ build-pass
#![allow(unused_must_use)]
#![allow(dead_code)]
#![allow(unused_mut)]
#![allow(non_camel_case_types)]
// Map representation
use Square::{Bot, ClosedLift, Earth, Empty, Lambda, OpenLift, Rock, Wall};
use std::fmt;
use std::io::prelude::*;
use square::{bot, wall, rock, lambda, closed_lift, open_lift, earth, empty};
enum square {
bot,
wall,
rock,
lambda,
closed_lift,
open_lift,
earth,
empty
enum Square {
Bot,
Wall,
Rock,
Lambda,
ClosedLift,
OpenLift,
Earth,
Empty,
}
impl fmt::Debug for square {
impl fmt::Debug for Square {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", match *self {
bot => { "R".to_string() }
wall => { "#".to_string() }
rock => { "*".to_string() }
lambda => { "\\".to_string() }
closed_lift => { "L".to_string() }
open_lift => { "O".to_string() }
earth => { ".".to_string() }
empty => { " ".to_string() }
})
write!(
f,
"{}",
match *self {
Bot => {
"R".to_string()
}
Wall => {
"#".to_string()
}
Rock => {
"*".to_string()
}
Lambda => {
"\\".to_string()
}
ClosedLift => {
"L".to_string()
}
OpenLift => {
"O".to_string()
}
Earth => {
".".to_string()
}
Empty => {
" ".to_string()
}
}
)
}
}
fn square_from_char(c: char) -> square {
match c {
'R' => { bot }
'#' => { wall }
'*' => { rock }
'\\' => { lambda }
'L' => { closed_lift }
'O' => { open_lift }
'.' => { earth }
' ' => { empty }
_ => {
println!("invalid square: {}", c);
panic!()
}
fn square_from_char(c: char) -> Square {
match c {
'R' => Bot,
'#' => Wall,
'*' => Rock,
'\\' => Lambda,
'L' => ClosedLift,
'O' => OpenLift,
'.' => Earth,
' ' => Empty,
_ => {
println!("invalid Square: {}", c);
panic!()
}
}
}
fn read_board_grid<rdr:'static + Read>(mut input: rdr)
-> Vec<Vec<square>> {
fn read_board_grid<Rdr: 'static + Read>(mut input: Rdr) -> Vec<Vec<Square>> {
let mut input: &mut dyn Read = &mut input;
let mut grid = Vec::new();
let mut line = [0; 10];
@ -65,14 +85,16 @@ fn read_board_grid<rdr:'static + Read>(mut input: rdr)
}
grid.push(row);
let width = grid[0].len();
for row in &grid { assert_eq!(row.len(), width) }
for row in &grid {
assert_eq!(row.len(), width)
}
grid
}
mod test {
#[test]
pub fn trivial_to_string() {
assert_eq!(lambda.to_string(), "\\")
assert_eq!(Lambda.to_string(), "\\")
}
}

View file

@ -1,15 +1,13 @@
//! Regression test for https://github.com/rust-lang/rust/issues/2708
//@ run-pass
#![allow(dead_code)]
#![allow(non_snake_case)]
struct Font {
fontbuf: usize,
cairo_font: usize,
font_dtor: usize,
}
impl Drop for Font {
@ -17,11 +15,7 @@ impl Drop for Font {
}
fn Font() -> Font {
Font {
fontbuf: 0,
cairo_font: 0,
font_dtor: 0
}
Font { fontbuf: 0, cairo_font: 0, font_dtor: 0 }
}
pub fn main() {

View file

@ -1,10 +1,12 @@
//! Regression test for https://github.com/rust-lang/rust/issues/2895
//@ run-pass
#![allow(dead_code)]
use std::mem;
struct Cat {
x: isize
x: isize,
}
struct Kitty {

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/2935
//@ run-pass
#![allow(dead_code)]
#![allow(non_camel_case_types)]
@ -11,14 +13,14 @@ trait it {
}
impl it for t {
fn f(&self) { }
fn f(&self) {}
}
pub fn main() {
// let x = ({a: 4} as it);
// let y = box ({a: 4});
// let z = box ({a: 4} as it);
// let z = box ({a: true} as it);
// let x = ({a: 4} as it);
// let y = box ({a: 4});
// let z = box ({a: 4} as it);
// let z = box ({a: true} as it);
let z: Box<_> = Box::new(Box::new(true) as Box<dyn it>);
// x.f();
// y.f();

View file

@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/3052
//@ run-pass
#![allow(dead_code)]
@ -8,5 +10,4 @@ fn f() -> Option<Connection> {
Some(mock_connection)
}
pub fn main() {
}
pub fn main() {}