Skip to content

Commit 4a57399

Browse files
committed
rustdoc-json: Add test for supertraits
1 parent be52b4a commit 4a57399

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Diff for: src/test/rustdoc-json/traits/supertrait.rs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// ignore-tidy-linelength
2+
3+
#![feature(no_core)]
4+
#![feature(lang_items)]
5+
#![no_core]
6+
7+
// @set loud_id = supertrait.json "$.index[*][?(@.name=='Loud')].id"
8+
pub trait Loud {}
9+
10+
// @set very_loud_id = - "$.index[*][?(@.name=='VeryLoud')].id"
11+
// @count - "$.index[*][?(@.name=='VeryLoud')].inner.bounds[*]" 1
12+
// @is - "$.index[*][?(@.name=='VeryLoud')].inner.bounds[0].trait_bound.trait.inner.id" $loud_id
13+
pub trait VeryLoud: Loud {}
14+
15+
// @set sounds_good_id = - "$.index[*][?(@.name=='SoundsGood')].id"
16+
pub trait SoundsGood {}
17+
18+
// @count - "$.index[*][?(@.name=='MetalBand')].inner.bounds[*]" 2
19+
// @is - "$.index[*][?(@.name=='MetalBand')].inner.bounds[0].trait_bound.trait.inner.id" $very_loud_id
20+
// @is - "$.index[*][?(@.name=='MetalBand')].inner.bounds[1].trait_bound.trait.inner.id" $sounds_good_id
21+
pub trait MetalBand: VeryLoud + SoundsGood {}
22+
23+
// @count - "$.index[*][?(@.name=='DnabLatem')].inner.bounds[*]" 2
24+
// @is - "$.index[*][?(@.name=='DnabLatem')].inner.bounds[1].trait_bound.trait.inner.id" $very_loud_id
25+
// @is - "$.index[*][?(@.name=='DnabLatem')].inner.bounds[0].trait_bound.trait.inner.id" $sounds_good_id
26+
pub trait DnabLatem: SoundsGood + VeryLoud {}

0 commit comments

Comments
 (0)