Skip to content
Merged

Move tests #152082

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/3026

//@ run-pass

use std::collections::HashMap;
Expand Down
79 changes: 0 additions & 79 deletions tests/ui/issues/issue-2904.rs

This file was deleted.

24 changes: 0 additions & 24 deletions tests/ui/issues/issue-3121.rs

This file was deleted.

37 changes: 37 additions & 0 deletions tests/ui/match/match-nested-enum-box-3121.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//! 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,
}
#[derive(Copy, Clone)]
enum order {
hamburger,
fries(side),
shake,
}
#[derive(Copy, Clone)]
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) => {}
}
}

pub fn main() {
foo(Box::new(meal::for_here(order::hamburger)), true)
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/3029

//@ run-fail
//@ error-pattern:so long
//@ needs-subprocess
Expand Down
101 changes: 101 additions & 0 deletions tests/ui/resolve/enum-variant-import-2904.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
//! Regression test for https://github.com/rust-lang/rust/issues/2904

//@ build-pass
#![allow(unused_must_use)]
#![allow(dead_code)]
#![allow(unused_mut)]

// Map representation

use Square::{Bot, ClosedLift, Earth, Empty, Lambda, OpenLift, Rock, Wall};
use std::fmt;
use std::io::prelude::*;

enum Square {
Bot,
Wall,
Rock,
Lambda,
ClosedLift,
OpenLift,
Earth,
Empty,
}

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()
}
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' => ClosedLift,
'O' => OpenLift,
'.' => Earth,
' ' => Empty,
_ => {
println!("invalid Square: {}", c);
panic!()
}
}
}

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];
input.read(&mut line);
let mut row = Vec::new();
for c in &line {
row.push(square_from_char(*c as char))
}
grid.push(row);
let width = grid[0].len();
for row in &grid {
assert_eq!(row.len(), width)
}
grid
}

mod test {
#[test]
pub fn trivial_to_string() {
assert_eq!(Lambda.to_string(), "\\")
}
}

pub fn main() {}
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
//! 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 {
fn drop(&mut self) {}
}

fn Font() -> Font {
Font {
fontbuf: 0,
cairo_font: 0,
font_dtor: 0
}
Font { fontbuf: 0, cairo_font: 0, font_dtor: 0 }
}

pub fn main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for https://github.com/rust-lang/rust/issues/3052
//@ run-pass
#![allow(dead_code)]

Expand All @@ -8,5 +10,4 @@ fn f() -> Option<Connection> {
Some(mock_connection)
}

pub fn main() {
}
pub fn main() {}
Loading