Skip to content

Commit 3d4e964

Browse files
committed
Difference tests for 'Item'
Can almost diff 'ast.rs' - macros and view paths are still wonky. Also revamped tests to be type-class based. The instances for 'NonEmpty', '[]', and 'Maybe' are particularly helpful. Progress made towards #16.
1 parent f4d4617 commit 3d4e964

File tree

7 files changed

+846
-632
lines changed

7 files changed

+846
-632
lines changed

sample-sources/expressions.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn main() {
2323
loop { break; }
2424
'l: loop { break 'l 1; }
2525
match x { _ => () }
26-
// let x = move |a,b,c| { a + b + c };
26+
let x = move |a,b,c| { a + b + c };
2727
let x = { 1 };
2828
let x = unsafe { 1 };
2929
a = 1;
@@ -44,3 +44,9 @@ fn main() {
4444
return 0;
4545
return;
4646
}
47+
48+
fn precedences() {
49+
x==&y||z|w.0<=x**y*&&z^=l^m<<=n;
50+
y|z..wm;
51+
1>!x%y-z*-w||u?==v;
52+
}

sample-sources/items.rs

+28-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ mod foo { }
1616
mod bar {
1717

1818
extern { }
19-
extern "C" { }
19+
extern "C" {
20+
fn foo(x: int) -> int;
21+
static x: int;
22+
static mut x: *mut int;
23+
}
2024

2125
type Foo = Bar<u8>;
2226

@@ -26,14 +30,33 @@ mod bar {
2630
union Foo<A, B> { x: A, y: B }
2731

2832
trait Foo { }
29-
trait Foo<T> { }
33+
trait Foo<T> {
34+
const ID1: i32;
35+
const ID2: i32 = 1;
36+
37+
fn area1(&self) -> f64;
38+
fn area2(&self) -> f64 { 1f64 }
39+
40+
type N;
41+
type N: fmt::Display;
42+
type N: fmt::Display = i32;
43+
44+
// foo!{}
45+
}
3046

3147
impl Trait for .. {}
3248
impl Trait<T> for .. {}
33-
impl<A> Foo<A> { }
49+
impl<A> Foo<A> {
50+
const ID: i32 = 1;
51+
fn area(&self) -> f64 { 1f64 }
52+
type N = i32;
53+
// foo!()
54+
55+
}
3456
impl<A> Trait for Foo<A> { }
57+
impl<A> !Trait for Foo<A> { }
3558

36-
macro_rules! foo { }
37-
foo!();
59+
// macro_rules! foo { }
60+
// foo!();
3861

3962
}

sample-sources/literals.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn main() {
2020
"hello world";
2121
r"hello world";
2222
r#"hello " world"#;
23-
// b"hello world";
23+
b"hello world";
2424
br"hello world";
2525
br#"hello " world"#;
2626

sample-sources/types.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,11 @@ fn main() {
2525

2626
fn foo() -> impl Bound1 + Bound2 + Bound3 { }
2727

28-
28+
pub fn walk<F: 'a + 'static>(x: i32, it: &mut F) -> bool
29+
where
30+
F: FnMut(&Pat) -> bool,
31+
'a: 'b + 'c,
32+
F = i32,
33+
{
34+
foo::<'a,A,B,C=i32>
35+
}

0 commit comments

Comments
 (0)