Rustdoc-Json: Clean up tests

This commit is contained in:
Nixon Enraght-Moony 2022-07-18 16:59:11 +01:00
parent 9ed0bf9f2b
commit dacffd22a0
3 changed files with 18 additions and 8 deletions

View file

@ -4,15 +4,19 @@
#![feature(no_core)]
// @is glob_extern.json "$.index[*][?(@.name=='mod1')].kind" \"module\"
// @is glob_extern.json "$.index[*][?(@.name=='mod1')].inner.is_stripped" "true"
// @is - "$.index[*][?(@.name=='mod1')].inner.is_stripped" "true"
mod mod1 {
extern "C" {
// @has - "$.index[*][?(@.name=='public_fn')].id"
// @set public_fn_id = - "$.index[*][?(@.name=='public_fn')].id"
pub fn public_fn();
// @!has - "$.index[*][?(@.name=='private_fn')]"
fn private_fn();
}
// @count - "$.index[*][?(@.name=='mod1')].inner.items[*]" 1
// @has - "$.index[*][?(@.name=='mod1')].inner.items[*]" $public_fn_id
// @set mod1_id = - "$.index[*][?(@.name=='mod1')].id"
}
// @is - "$.index[*][?(@.kind=='import')].inner.glob" true
// @is - "$.index[*][?(@.kind=='import')].inner.id" $mod1_id
pub use mod1::*;

View file

@ -1,7 +1,7 @@
// aux-build:pub-struct.rs
// Test for the ICE in rust/83057
// Am external type re-exported with different attributes shouldn't cause an error
// Test for the ICE in https://github.com/rust-lang/rust/issues/83057
// An external type re-exported with different attributes shouldn't cause an error
#![no_core]
#![feature(no_core)]

View file

@ -1,4 +1,4 @@
// Test for the ICE in rust/83720
// Test for the ICE in https://github.com/rust-lang/rust/issues/83720
// A pub-in-private type re-exported under two different names shouldn't cause an error
#![no_core]
@ -7,11 +7,17 @@
// @is private_two_names.json "$.index[*][?(@.name=='style')].kind" \"module\"
// @is private_two_names.json "$.index[*][?(@.name=='style')].inner.is_stripped" "true"
mod style {
// @has - "$.index[*](?(@.name=='Color'))"
// @set color_struct_id = - "$.index[*][?(@.kind=='struct' && @.name=='Color')].id"
pub struct Color;
}
// @has - "$.index[*][?(@.kind=='import' && @.inner.name=='Color')]"
// @is - "$.index[*][?(@.kind=='import' && @.inner.name=='Color')].inner.id" $color_struct_id
// @set color_export_id = - "$.index[*][?(@.kind=='import' && @.inner.name=='Color')].id"
pub use style::Color;
// @has - "$.index[*][?(@.kind=='import' && @.inner.name=='Colour')]"
// @is - "$.index[*][?(@.kind=='import' && @.inner.name=='Colour')].inner.id" $color_struct_id
// @set colour_export_id = - "$.index[*][?(@.kind=='import' && @.inner.name=='Colour')].id"
pub use style::Color as Colour;
// @count - "$.index[*][?(@.name=='private_two_names')].inner.items[*]" 2
// @has - "$.index[*][?(@.name=='private_two_names')].inner.items[*]" $color_export_id
// @has - "$.index[*][?(@.name=='private_two_names')].inner.items[*]" $colour_export_id