Skip to content

Commit

Permalink
Renamed directories with queries and tests (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonowak authored Nov 24, 2022
1 parent 17e5435 commit be843b8
Show file tree
Hide file tree
Showing 69 changed files with 92 additions and 92 deletions.
10 changes: 5 additions & 5 deletions scripts/regenerate_test_rustdocs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# Fail on first error, on undefined variables, and on failures in pipelines.
set -euo pipefail

# Go to the semver_tests directory.
cd "$(git rev-parse --show-toplevel)/semver_tests"
# Go to the test_crates directory.
cd "$(git rev-parse --show-toplevel)/test_crates"

export CARGO_TARGET_DIR=/tmp/semver_tests
RUSTDOC_OUTPUT="$CARGO_TARGET_DIR/doc/semver_tests.json"
export CARGO_TARGET_DIR=/tmp/test_crates
RUSTDOC_OUTPUT="$CARGO_TARGET_DIR/doc/test_crates.json"
TARGET_DIR="$(git rev-parse --show-toplevel)/localdata/test_data"

# Allow setting an explicit toolchain, like +nightly or +beta.
Expand All @@ -26,7 +26,7 @@ mv "$RUSTDOC_OUTPUT" "$TARGET_DIR/baseline.json"

# For each feature, re-run rustdoc with it enabled.
features="$(cargo metadata --format-version 1 | \
jq --exit-status -r '.packages[] | select(.name = "semver_tests") | .features | keys[]')"
jq --exit-status -r '.packages[] | select(.name = "test_crates") | .features | keys[]')"
while IFS= read -r feat; do
echo "Generating: $feat"
RUSTC_BOOTSTRAP=1 $RUSTDOC_CMD --features "$feat" -- -Zunstable-options --output-format json
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
58 changes: 29 additions & 29 deletions src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,28 +76,28 @@ impl SemverQuery {
let mut queries = BTreeMap::default();

let query_text_contents = [
include_str!("./queries/auto_trait_impl_removed.ron"),
include_str!("./queries/derive_trait_impl_removed.ron"),
include_str!("./queries/enum_marked_non_exhaustive.ron"),
include_str!("./queries/enum_missing.ron"),
include_str!("./queries/enum_repr_c_removed.ron"),
include_str!("./queries/enum_repr_int_changed.ron"),
include_str!("./queries/enum_repr_int_removed.ron"),
include_str!("./queries/enum_variant_added.ron"),
include_str!("./queries/enum_variant_missing.ron"),
include_str!("./queries/enum_struct_variant_field_missing.ron"),
include_str!("./queries/function_missing.ron"),
include_str!("./queries/function_parameter_count_changed.ron"),
include_str!("./queries/inherent_method_missing.ron"),
include_str!("./queries/method_parameter_count_changed.ron"),
include_str!("./queries/sized_impl_removed.ron"),
include_str!("./queries/struct_marked_non_exhaustive.ron"),
include_str!("./queries/struct_missing.ron"),
include_str!("./queries/struct_pub_field_missing.ron"),
include_str!("./queries/struct_repr_c_removed.ron"),
include_str!("./queries/struct_repr_transparent_removed.ron"),
include_str!("./queries/unit_struct_changed_kind.ron"),
include_str!("./queries/variant_marked_non_exhaustive.ron"),
include_str!("./lints/auto_trait_impl_removed.ron"),
include_str!("./lints/derive_trait_impl_removed.ron"),
include_str!("./lints/enum_marked_non_exhaustive.ron"),
include_str!("./lints/enum_missing.ron"),
include_str!("./lints/enum_repr_c_removed.ron"),
include_str!("./lints/enum_repr_int_changed.ron"),
include_str!("./lints/enum_repr_int_removed.ron"),
include_str!("./lints/enum_variant_added.ron"),
include_str!("./lints/enum_variant_missing.ron"),
include_str!("./lints/enum_struct_variant_field_missing.ron"),
include_str!("./lints/function_missing.ron"),
include_str!("./lints/function_parameter_count_changed.ron"),
include_str!("./lints/inherent_method_missing.ron"),
include_str!("./lints/method_parameter_count_changed.ron"),
include_str!("./lints/sized_impl_removed.ron"),
include_str!("./lints/struct_marked_non_exhaustive.ron"),
include_str!("./lints/struct_missing.ron"),
include_str!("./lints/struct_pub_field_missing.ron"),
include_str!("./lints/struct_repr_c_removed.ron"),
include_str!("./lints/struct_repr_transparent_removed.ron"),
include_str!("./lints/unit_struct_changed_kind.ron"),
include_str!("./lints/variant_marked_non_exhaustive.ron"),
];
for query_text in query_text_contents {
let query: SemverQuery = ron::from_str(query_text).unwrap_or_else(|e| {
Expand Down Expand Up @@ -185,7 +185,7 @@ mod tests {
.collect();

let expected_result: FieldValue = vec![
"semver_tests",
"test_crates",
"import_handling",
"inner",
"CheckPubUseHandling",
Expand All @@ -203,10 +203,10 @@ mod tests {
actual_paths.sort_unstable();

let expected_paths = vec![
vec!["semver_tests", "CheckPubUseHandling"],
vec!["semver_tests", "import_handling", "CheckPubUseHandling"],
vec!["test_crates", "CheckPubUseHandling"],
vec!["test_crates", "import_handling", "CheckPubUseHandling"],
vec![
"semver_tests",
"test_crates",
"import_handling",
"inner",
"CheckPubUseHandling",
Expand All @@ -229,12 +229,12 @@ mod tests {
let current = VersionedIndexedCrate::new(&current_crate);

let query_text =
std::fs::read_to_string(&format!("./src/queries/{}.ron", query_name)).unwrap();
std::fs::read_to_string(&format!("./src/lints/{}.ron", query_name)).unwrap();
let semver_query: SemverQuery = ron::from_str(&query_text).unwrap();

let expected_result_text =
std::fs::read_to_string(&format!("./src/test_data/{}.output.ron", query_name))
.with_context(|| format!("Could not load src/test_data/{}.output.ron expected-outputs file, did you forget to add it?", query_name))
std::fs::read_to_string(&format!("./test_outputs/{}.output.ron", query_name))
.with_context(|| format!("Could not load test_outputs/{}.output.ron expected-outputs file, did you forget to add it?", query_name))
.expect("failed to load expected outputs");
let mut expected_results: Vec<BTreeMap<String, FieldValue>> =
ron::from_str(&expected_result_text)
Expand Down
2 changes: 1 addition & 1 deletion semver_tests/Cargo.lock → test_crates/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion semver_tests/Cargo.toml → test_crates/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "semver_tests"
name = "test_crates"
version = "0.1.0"
edition = "2021"

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": String("SyncStruct"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("auto_trait_impl_removed"),
String("SyncStruct"),
Expand All @@ -20,7 +20,7 @@
{
"name": String("SendStruct"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("auto_trait_impl_removed"),
String("SendStruct"),
Expand All @@ -38,7 +38,7 @@
{
"name": String("UnwindSafeStruct"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("auto_trait_impl_removed"),
String("UnwindSafeStruct"),
Expand All @@ -57,7 +57,7 @@
{
"name": String("RefUnwindSafeStruct"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("auto_trait_impl_removed"),
String("RefUnwindSafeStruct"),
Expand All @@ -76,7 +76,7 @@
{
"name": String("UnpinStruct"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("auto_trait_impl_removed"),
String("UnpinStruct"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": String("DebugFoo"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("derive_trait_impl_removed"),
String("DebugFoo"),
Expand All @@ -20,7 +20,7 @@
{
"name": String("CopyBar"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("derive_trait_impl_removed"),
String("CopyBar"),
Expand All @@ -38,7 +38,7 @@
{
"name": String("EqFoo"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("derive_trait_impl_removed"),
String("EqFoo"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": String("SimpleEnum"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("non_exhaustive"),
String("SimpleEnum"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": String("WillBeRemovedEnum"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("item_missing"),
String("WillBeRemovedEnum"),
Expand All @@ -14,7 +14,7 @@
{
"name": String("PubUseRemovedEnum"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("item_missing"),
String("PubUseRemovedEnum"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": String("Foo"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("enum_repr_c_removed"),
String("Foo"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": String("U8ToU16Enum"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("enum_repr_int_changed"),
String("U8ToU16Enum"),
Expand All @@ -18,7 +18,7 @@
{
"name": String("I32ToI8Enum"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("enum_repr_int_changed"),
String("I32ToI8Enum"),
Expand All @@ -34,7 +34,7 @@
{
"name": String("I32ToU32Enum"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("enum_repr_int_changed"),
String("I32ToU32Enum"),
Expand All @@ -50,7 +50,7 @@
{
"name": String("IsizeToUsizeEnum"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("enum_repr_int_changed"),
String("IsizeToUsizeEnum"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": String("U8Enum"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("enum_repr_int_removed"),
String("U8Enum"),
Expand All @@ -14,7 +14,7 @@
{
"name": String("I32Enum"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("enum_repr_int_removed"),
String("I32Enum"),
Expand All @@ -26,7 +26,7 @@
{
"name": String("IsizeEnum"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("enum_repr_int_removed"),
String("IsizeEnum"),
Expand All @@ -38,7 +38,7 @@
{
"name": String("UsizeEnum"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("enum_repr_int_removed"),
String("UsizeEnum"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"enum_name": String("Enum"),
"variant_name": String("FieldWillBeMissing"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("enum_struct_variant_field_missing"),
String("Enum"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"enum_name": String("EnumWithNewVariant"),
"variant_name": String("NewVariant"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("enum_variant_added"),
String("EnumWithNewVariant"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"enum_name": String("VariantWillBeRemoved"),
"variant_name": String("Bar"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("enum_variant_missing"),
String("VariantWillBeRemoved"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": String("will_be_removed_fn"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("item_missing"),
String("will_be_removed_fn"),
Expand All @@ -14,7 +14,7 @@
{
"name": String("pub_use_removed_fn"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("item_missing"),
String("pub_use_removed_fn"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": String("function_with_a_parameter_added"),
"old_parameter_count": Uint64(1),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("parameter_count_changed"),
String("function_with_a_parameter_added")
Expand All @@ -18,7 +18,7 @@
"name": String("function_with_parameters_removed"),
"old_parameter_count": Uint64(2),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("parameter_count_changed"),
String("function_with_parameters_removed")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": String("Foo"),
"method_name": String("will_be_removed_associated_fn"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("item_missing"),
String("Foo"),
Expand All @@ -17,7 +17,7 @@
"name": String("Foo"),
"method_name": String("will_be_removed_method"),
"path": List([
String("semver_tests"),
String("test_crates"),
String("test_cases"),
String("item_missing"),
String("Foo"),
Expand Down
Loading

0 comments on commit be843b8

Please sign in to comment.