Skip to content

Commit

Permalink
Update tests accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Feb 27, 2017
1 parent d06f72d commit bd704ba
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
8 changes: 5 additions & 3 deletions src/test/rustdoc/assoc-consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@
pub trait Foo {
// @has assoc_consts/trait.Foo.html '//*[@class="rust trait"]' \
// 'const FOO: usize;'
// @has - '//*[@id="associatedconstant.FOO"]' 'const FOO'
const FOO: usize;
// @has - '//*[@id="associatedconstant.FOO"]' 'const FOO: usize'
// @has - '//*[@class="docblock"]' 'FOO: usize = 12'
const FOO: usize = 12;
}

pub struct Bar;

impl Bar {
// @has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.BAR"]' \
// 'const BAR: usize = 3'
// 'const BAR: usize'
// @has - '//*[@class="docblock"]' 'BAR: usize = 3'
pub const BAR: usize = 3;
}
3 changes: 2 additions & 1 deletion src/test/rustdoc/issue-28478.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ pub trait Bar {
// @has - '//*[@id="associatedtype.Bar"]' 'type Bar = ()'
// @has - '//*[@href="#associatedtype.Bar"]' 'Bar'
type Bar = ();
// @has - '//*[@id="associatedconstant.Baz"]' 'const Baz: usize = 7'
// @has - '//*[@id="associatedconstant.Baz"]' 'const Baz: usize'
// @has - '//*[@class="docblock"]' 'Baz: usize = 7'
// @has - '//*[@href="#associatedconstant.Baz"]' 'Baz'
const Baz: usize = 7;
// @has - '//*[@id="tymethod.bar"]' 'fn bar'
Expand Down
30 changes: 26 additions & 4 deletions src/test/rustdoc/issue-33302.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,40 @@ macro_rules! make {
fn ignore(_: &X) {}
const C: X;
// @has issue_33302/trait.T.html \
// '//*[@class="rust trait"]' 'const D: i32 = 4 * 4;'
// @has - '//*[@id="associatedconstant.D"]' 'const D: i32 = 4 * 4'
// '//*[@class="rust trait"]' 'const D: i32'
// @has - '//*[@class="docblock"]' 'D: i32 = 4 * 4'
// @has - '//*[@id="associatedconstant.D"]' 'const D: i32'
const D: i32 = ($n * $n);
}

// @has issue_33302/struct.S.html \
// '//h3[@class="impl"]' 'impl T<[i32; 16]> for S'
// @has - '//*[@id="associatedconstant.C"]' 'const C: [i32; 16] = [0; 4 * 4]'
// @has - '//*[@id="associatedconstant.D"]' 'const D: i32 = 4 * 4'
// @has - '//*[@id="associatedconstant.C"]' 'const C: [i32; 16]'
// @has - '//*[@id="associatedconstant.D"]' 'const D: i32'
// @has - '//*[@class="docblock"]' 'C: [i32; 16] = [0; 4 * 4]'
impl T<[i32; ($n * $n)]> for S {
const C: [i32; ($n * $n)] = [0; ($n * $n)];
}

// @has issue_33302/struct.S.html \
// '//h3[@class="impl"]' 'impl T<[i32; 16]> for S'
// @has - '//*[@id="associatedconstant.C-1"]' 'const C: (i32,)'
// @has - '//*[@id="associatedconstant.D-1"]' 'const D: i32'
// @has - '//*[@class="docblock"]' 'C: (i32,) = (4,)'
impl T<(i32,)> for S {
const C: (i32,) = ($n,);
}

// @has issue_33302/struct.S.html \
// '//h3[@class="impl"]' 'impl T<(i32, i32)> for S'
// @has - '//*[@id="associatedconstant.C-2"]' 'const C: (i32, i32)'
// @has - '//*[@id="associatedconstant.D-2"]' 'const D: i32'
// @has - '//*[@class="docblock"]' 'C: (i32, i32) = (4, 4)'
// @has - '//*[@class="docblock"]' 'D: i32 = 4 / 4'
impl T<(i32, i32)> for S {
const C: (i32, i32) = ($n, $n);
const D: i32 = ($n / $n);
}
}
}

Expand Down

0 comments on commit bd704ba

Please sign in to comment.