Skip to content

Commit 9da7be9

Browse files
committed
Merge pull request #101 from nrc/test
Add a terrible, but useful, test which I used locally
2 parents 8931fb0 + caa10d4 commit 9da7be9

File tree

6 files changed

+297
-0
lines changed

6 files changed

+297
-0
lines changed

tests/source/doc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
// sadfsdfa
3+
//sdffsdfasdf

tests/source/multiple.rs

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
// Test of lots of random stuff.
2+
// FIXME split this into multiple, self-contained tests.
3+
4+
5+
#[attr1] extern crate foo;
6+
#[attr2] #[attr3] extern crate foo;
7+
#[attr1]extern crate foo;
8+
#[attr2]#[attr3]extern crate foo;
9+
10+
use std::cell::*;
11+
use std::{any, ascii, self, borrow, boxed, char, borrow, boxed, char, borrow, borrow, boxed, char, borrow, boxed, char, borrow, boxed, char, borrow, boxed, char, borrow, boxed, char, borrow, boxed, char, borrow, boxed, char, borrow, boxed, char};
12+
13+
mod doc;
14+
mod other;
15+
16+
17+
// sfdgfffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffff
18+
19+
fn foo(a: isize,
20+
b: u32, /* blah blah */
21+
c: f64) {
22+
23+
}
24+
25+
fn foo() where 'a: 'b, for<'a> D<'b>: 'a {
26+
hello!()
27+
}
28+
29+
fn baz<'a: 'b /* comment on 'a */, T: SomsssssssssssssssssssssssssssssssssssssssssssssssssssssseType /* comment on T */>(a: A, b: B /* comment on b */, c: C) -> Bob {
30+
#[attr1] extern crate foo;
31+
#[attr2] #[attr3] extern crate foo;
32+
#[attr1]extern crate foo;
33+
#[attr2]#[attr3]extern crate foo;
34+
}
35+
36+
#[rustfmt_skip]
37+
fn qux(a: dadsfa, // Comment 1
38+
b: sdfasdfa, // Comment 2
39+
c: dsfdsafa) // Comment 3
40+
{
41+
42+
}
43+
44+
/// Blah blah blah.
45+
impl Bar {
46+
fn foo(&mut self, a: sdfsdfcccccccccccccccccccccccccccccccccccccccccccccccccccccccc, // comment on a
47+
b: sdfasdfsdfasfs /*closing comment*/ ) -> isize {}
48+
49+
/// Blah blah blah.
50+
pub fn f2(self) {
51+
(foo, bar)
52+
}
53+
54+
#[an_attribute]
55+
fn f3(self) -> Dog {
56+
}
57+
}
58+
59+
/// The `nodes` and `edges` method each return instantiations of
60+
/// `Cow<[T]>` to leave implementers the freedom to create
61+
62+
/// entirely new vectors or to pass back slices into internally owned
63+
/// vectors.
64+
pub trait GraphWalk<'a, N, E> {
65+
/// Returns all the nodes in this graph.
66+
fn nodes(&'a self) -> Nodes<'a, N>;
67+
/// Returns all of the edges in this graph.
68+
fn edges(&'a self) -> Edges<'a, E>;
69+
/// The source node for `edge`.
70+
fn source(&'a self, edge: &E) -> N;
71+
/// The target node for `edge`.
72+
fn target(&'a self, edge: &E) -> N;
73+
}
74+
75+
/// A Doc comment
76+
#[AnAttribute]
77+
pub struct Foo {
78+
#[rustfmt_skip]
79+
f : SomeType, // Comment beside a field
80+
f : SomeType, // Comment beside a field
81+
// Comment on a field
82+
g: SomeOtherType,
83+
/// A doc comment on a field
84+
h: AThirdType,}
85+
86+
struct Bar;
87+
88+
// With a where clause and generics.
89+
pub struct Foo<'a, Y: Baz>
90+
where X: Whatever
91+
{
92+
f: SomeType, // Comment beside a field
93+
}
94+
95+
fn main() {
96+
for i in 0i32..4 {
97+
println!("{}", i);
98+
}
99+
100+
101+
while true {
102+
hello();
103+
}
104+
105+
let rc = Cell::new(42usize,42usize, Cell::new(42usize, remaining_widthremaining_widthremaining_widthremaining_width), 42usize);
106+
let rc = RefCell::new(42usize,remaining_width, remaining_width); // a comment
107+
let x = "Hello!!!!!!!!! abcd abcd abcd abcd abcd abcd\n abcd abcd abcd abcd abcd abcd abcd abcd abcd \
108+
abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \
109+
abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd"; }
110+
111+
112+
fn struct_lits() {
113+
let x = Bar;
114+
// Comment
115+
let y = Foo { a: x };
116+
Foo { a: foo() /* comment*/, /* comment*/ b: bar(), ..something };
117+
Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo { a: foo(), b: bar(), };
118+
Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo {
119+
// Comment
120+
a: foo(), // Comment
121+
// Comment
122+
b: bar(), // Comment
123+
};
124+
125+
Foo { a: Bar,
126+
b: foo() };
127+
}

tests/source/other.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Part of multiple.rs
2+
3+
fn bob() {
4+
println!("hello other!");
5+
}

tests/target/doc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
// sadfsdfa
3+
//sdffsdfasdf

tests/target/multiple.rs

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
// Test of lots of random stuff.
2+
// FIXME split this into multiple, self-contained tests.
3+
4+
5+
#[attr1]
6+
extern crate foo;
7+
#[attr2]
8+
#[attr3]
9+
extern crate foo;
10+
#[attr1]
11+
extern crate foo;
12+
#[attr2]
13+
#[attr3]
14+
extern crate foo;
15+
16+
use std::cell::*;
17+
use std::{self, any, ascii, borrow, boxed, char, borrow, boxed, char, borrow,
18+
borrow, boxed, char, borrow, boxed, char, borrow, boxed, char,
19+
borrow, boxed, char, borrow, boxed, char, borrow, boxed, char,
20+
borrow, boxed, char, borrow, boxed, char};
21+
22+
mod doc;
23+
mod other;
24+
25+
26+
// sfdgfffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffff
27+
28+
fn foo(a: isize, b: u32 /* blah blah */, c: f64) {
29+
30+
}
31+
32+
fn foo()
33+
where 'a: 'b,
34+
for<'a> D<'b>: 'a
35+
{
36+
hello!()
37+
}
38+
39+
fn baz<'a: 'b, /* comment on 'a */
40+
T: SomsssssssssssssssssssssssssssssssssssssssssssssssssssssseType /* comment on T */>
41+
(a: A,
42+
b: B, /* comment on b */
43+
c: C)
44+
-> Bob {
45+
#[attr1]
46+
extern crate foo;
47+
#[attr2]
48+
#[attr3]
49+
extern crate foo;
50+
#[attr1]
51+
extern crate foo;
52+
#[attr2]
53+
#[attr3]
54+
extern crate foo;
55+
}
56+
57+
#[rustfmt_skip]
58+
fn qux(a: dadsfa, // Comment 1
59+
b: sdfasdfa, // Comment 2
60+
c: dsfdsafa) // Comment 3
61+
{
62+
63+
}
64+
65+
/// Blah blah blah.
66+
impl Bar {
67+
fn foo(&mut self,
68+
a: sdfsdfcccccccccccccccccccccccccccccccccccccccccccccccccccccccc, // comment on a
69+
b: sdfasdfsdfasfs /*closing comment*/)
70+
-> isize {
71+
}
72+
73+
/// Blah blah blah.
74+
pub fn f2(self) {
75+
(foo, bar)
76+
}
77+
78+
#[an_attribute]
79+
fn f3(self) -> Dog {
80+
}
81+
}
82+
83+
/// The `nodes` and `edges` method each return instantiations of
84+
/// `Cow<[T]>` to leave implementers the freedom to create
85+
86+
/// entirely new vectors or to pass back slices into internally owned
87+
/// vectors.
88+
pub trait GraphWalk<'a, N, E> {
89+
/// Returns all the nodes in this graph.
90+
fn nodes(&'a self) -> Nodes<'a, N>;
91+
/// Returns all of the edges in this graph.
92+
fn edges(&'a self) -> Edges<'a, E>;
93+
/// The source node for `edge`.
94+
fn source(&'a self, edge: &E) -> N;
95+
/// The target node for `edge`.
96+
fn target(&'a self, edge: &E) -> N;
97+
}
98+
99+
/// A Doc comment
100+
#[AnAttribute]
101+
pub struct Foo {
102+
#[rustfmt_skip]
103+
f : SomeType, // Comment beside a field
104+
f: SomeType, // Comment beside a field
105+
// Comment on a field
106+
g: SomeOtherType,
107+
/// A doc comment on a field
108+
h: AThirdType,
109+
}
110+
111+
struct Bar;
112+
113+
// With a where clause and generics.
114+
pub struct Foo<'a, Y: Baz>
115+
where X: Whatever
116+
{
117+
f: SomeType, // Comment beside a field
118+
}
119+
120+
fn main() {
121+
for i in 0i32..4 {
122+
println!("{}", i);
123+
}
124+
125+
126+
while true {
127+
hello();
128+
}
129+
130+
let rc = Cell::new(42usize,
131+
42usize,
132+
Cell::new(42usize,
133+
remaining_widthremaining_widthremaining_widthremaining_width),
134+
42usize);
135+
let rc = RefCell::new(42usize, remaining_width, remaining_width); // a comment
136+
let x = "Hello!!!!!!!!! abcd abcd abcd abcd abcd abcd\n abcd abcd abcd abcd abcd abcd abcd \
137+
abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \
138+
abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd \
139+
abcd";
140+
}
141+
142+
143+
fn struct_lits() {
144+
let x = Bar;
145+
// Comment
146+
let y = Foo { a: x };
147+
Foo { a: foo(), b: bar(), ..something };
148+
Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo { a: foo(),
149+
b: bar(), };
150+
Fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo { a: foo(),
151+
b: bar(), };
152+
153+
Foo { a: Bar, b: foo() };
154+
}

tests/target/other.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Part of multiple.rs
2+
3+
fn bob() {
4+
println!("hello other!");
5+
}

0 commit comments

Comments
 (0)