diff --git a/codegen-java/tests/test.rs b/codegen-java/tests/test.rs index 7d0ecb0..604d2b8 100644 --- a/codegen-java/tests/test.rs +++ b/codegen-java/tests/test.rs @@ -31,7 +31,7 @@ static MANIFEST: LazyLock = LazyLock::new(|| { } }); -#[fixture("../test-data/*.json")] +#[fixture("../test-data/**/*.json")] async fn java_test>(input_filepath: P) { jsoncodegen_test_utils::test(&MANIFEST, codegen, &input_filepath).await; } diff --git a/codegen-rust/tests/test.rs b/codegen-rust/tests/test.rs index fbfdb5c..eca9f1c 100644 --- a/codegen-rust/tests/test.rs +++ b/codegen-rust/tests/test.rs @@ -23,7 +23,7 @@ static MANIFEST: LazyLock = LazyLock::new(|| { } }); -#[fixture("../test-data/*.json")] +#[fixture("../test-data/**/*.json")] async fn rust_test>(input_filepath: P) { jsoncodegen_test_utils::test(&MANIFEST, codegen, &input_filepath).await; } diff --git a/test-data/ansible-playbook.yaml b/test-data/ansible/ansible-playbook.yaml similarity index 100% rename from test-data/ansible-playbook.yaml rename to test-data/ansible/ansible-playbook.yaml diff --git a/test-data/claude-messages-api.json b/test-data/anthropic/claude-messages-api.json similarity index 100% rename from test-data/claude-messages-api.json rename to test-data/anthropic/claude-messages-api.json diff --git a/test-data/asyncapi-spec.json b/test-data/asyncapi/asyncapi-spec.json similarity index 100% rename from test-data/asyncapi-spec.json rename to test-data/asyncapi/asyncapi-spec.json diff --git a/test-data/asyncapi.yaml b/test-data/asyncapi/asyncapi.yaml similarity index 100% rename from test-data/asyncapi.yaml rename to test-data/asyncapi/asyncapi.yaml diff --git a/test-data/aws-cloudformation.json b/test-data/aws/aws-cloudformation.json similarity index 100% rename from test-data/aws-cloudformation.json rename to test-data/aws/aws-cloudformation.json diff --git a/test-data/aws-cloudwatch-event.json b/test-data/aws/aws-cloudwatch-event.json similarity index 100% rename from test-data/aws-cloudwatch-event.json rename to test-data/aws/aws-cloudwatch-event.json diff --git a/test-data/aws-s3-event.json b/test-data/aws/aws-s3-event.json similarity index 100% rename from test-data/aws-s3-event.json rename to test-data/aws/aws-s3-event.json diff --git a/test-data/azure-pipelines.yml b/test-data/azure-devops/azure-pipelines.yml similarity index 100% rename from test-data/azure-pipelines.yml rename to test-data/azure-devops/azure-pipelines.yml diff --git a/test-data/azure-arm-template.json b/test-data/azure/azure-arm-template.json similarity index 100% rename from test-data/azure-arm-template.json rename to test-data/azure/azure-arm-template.json diff --git a/test-data/babel-config.json b/test-data/babel/babel-config.json similarity index 100% rename from test-data/babel-config.json rename to test-data/babel/babel-config.json diff --git a/test-data/Cargo.toml b/test-data/cargo/Cargo.toml similarity index 100% rename from test-data/Cargo.toml rename to test-data/cargo/Cargo.toml diff --git a/test-data/circleci-config.yml b/test-data/circleci/circleci-config.yml similarity index 100% rename from test-data/circleci-config.yml rename to test-data/circleci/circleci-config.yml diff --git a/test-data/composer.json b/test-data/composer/composer.json similarity index 100% rename from test-data/composer.json rename to test-data/composer/composer.json diff --git a/test-data/analytics-events.json b/test-data/core-types/analytics-events.json similarity index 100% rename from test-data/analytics-events.json rename to test-data/core-types/analytics-events.json diff --git a/test-data/array-bool.json b/test-data/core-types/array-bool.json similarity index 100% rename from test-data/array-bool.json rename to test-data/core-types/array-bool.json diff --git a/test-data/array-float.json b/test-data/core-types/array-float.json similarity index 100% rename from test-data/array-float.json rename to test-data/core-types/array-float.json diff --git a/test-data/array-int.json b/test-data/core-types/array-int.json similarity index 100% rename from test-data/array-int.json rename to test-data/core-types/array-int.json diff --git a/test-data/array-objects-optional-field-1.json b/test-data/core-types/array-objects-optional-field-1.json similarity index 100% rename from test-data/array-objects-optional-field-1.json rename to test-data/core-types/array-objects-optional-field-1.json diff --git a/test-data/array-objects-optional-field-2.json b/test-data/core-types/array-objects-optional-field-2.json similarity index 100% rename from test-data/array-objects-optional-field-2.json rename to test-data/core-types/array-objects-optional-field-2.json diff --git a/test-data/array-objects-optional-field-3.json b/test-data/core-types/array-objects-optional-field-3.json similarity index 100% rename from test-data/array-objects-optional-field-3.json rename to test-data/core-types/array-objects-optional-field-3.json diff --git a/test-data/array-str.json b/test-data/core-types/array-str.json similarity index 100% rename from test-data/array-str.json rename to test-data/core-types/array-str.json diff --git a/test-data/edge-cases-comprehensive.json b/test-data/core-types/edge-cases-comprehensive.json similarity index 100% rename from test-data/edge-cases-comprehensive.json rename to test-data/core-types/edge-cases-comprehensive.json diff --git a/test-data/empty-array-then-values.json b/test-data/core-types/empty-array-then-values.json similarity index 100% rename from test-data/empty-array-then-values.json rename to test-data/core-types/empty-array-then-values.json diff --git a/test-data/empty-array-with-null.json b/test-data/core-types/empty-array-with-null.json similarity index 100% rename from test-data/empty-array-with-null.json rename to test-data/core-types/empty-array-with-null.json diff --git a/test-data/empty-array.json b/test-data/core-types/empty-array.json similarity index 100% rename from test-data/empty-array.json rename to test-data/core-types/empty-array.json diff --git a/test-data/empty-object.json b/test-data/core-types/empty-object.json similarity index 100% rename from test-data/empty-object.json rename to test-data/core-types/empty-object.json diff --git a/test-data/linked-list.json b/test-data/core-types/linked-list.json similarity index 100% rename from test-data/linked-list.json rename to test-data/core-types/linked-list.json diff --git a/test-data/mixed-nesting.json b/test-data/core-types/mixed-nesting.json similarity index 100% rename from test-data/mixed-nesting.json rename to test-data/core-types/mixed-nesting.json diff --git a/test-data/nested-array-int.json b/test-data/core-types/nested-array-int.json similarity index 100% rename from test-data/nested-array-int.json rename to test-data/core-types/nested-array-int.json diff --git a/test-data/nested-array-union.json b/test-data/core-types/nested-array-union.json similarity index 100% rename from test-data/nested-array-union.json rename to test-data/core-types/nested-array-union.json diff --git a/test-data/null-only.json b/test-data/core-types/null-only.json similarity index 100% rename from test-data/null-only.json rename to test-data/core-types/null-only.json diff --git a/test-data/object-array-int.json b/test-data/core-types/object-array-int.json similarity index 100% rename from test-data/object-array-int.json rename to test-data/core-types/object-array-int.json diff --git a/test-data/object-array-union.json b/test-data/core-types/object-array-union.json similarity index 100% rename from test-data/object-array-union.json rename to test-data/core-types/object-array-union.json diff --git a/test-data/object-deeply-nested.json b/test-data/core-types/object-deeply-nested.json similarity index 100% rename from test-data/object-deeply-nested.json rename to test-data/core-types/object-deeply-nested.json diff --git a/test-data/object-int.json b/test-data/core-types/object-int.json similarity index 100% rename from test-data/object-int.json rename to test-data/core-types/object-int.json diff --git a/test-data/object-null.json b/test-data/core-types/object-null.json similarity index 100% rename from test-data/object-null.json rename to test-data/core-types/object-null.json diff --git a/test-data/object-with-empty-array.json b/test-data/core-types/object-with-empty-array.json similarity index 100% rename from test-data/object-with-empty-array.json rename to test-data/core-types/object-with-empty-array.json diff --git a/test-data/optional-array-null-first.json b/test-data/core-types/optional-array-null-first.json similarity index 100% rename from test-data/optional-array-null-first.json rename to test-data/core-types/optional-array-null-first.json diff --git a/test-data/optional-array-value-first.json b/test-data/core-types/optional-array-value-first.json similarity index 100% rename from test-data/optional-array-value-first.json rename to test-data/core-types/optional-array-value-first.json diff --git a/test-data/optional-bool.json b/test-data/core-types/optional-bool.json similarity index 100% rename from test-data/optional-bool.json rename to test-data/core-types/optional-bool.json diff --git a/test-data/optional-int-multiple-nulls.json b/test-data/core-types/optional-int-multiple-nulls.json similarity index 100% rename from test-data/optional-int-multiple-nulls.json rename to test-data/core-types/optional-int-multiple-nulls.json diff --git a/test-data/optional-int-null-first.json b/test-data/core-types/optional-int-null-first.json similarity index 100% rename from test-data/optional-int-null-first.json rename to test-data/core-types/optional-int-null-first.json diff --git a/test-data/optional-int-value-first.json b/test-data/core-types/optional-int-value-first.json similarity index 100% rename from test-data/optional-int-value-first.json rename to test-data/core-types/optional-int-value-first.json diff --git a/test-data/optional-str.json b/test-data/core-types/optional-str.json similarity index 100% rename from test-data/optional-str.json rename to test-data/core-types/optional-str.json diff --git a/test-data/optional-union-int-float.json b/test-data/core-types/optional-union-int-float.json similarity index 100% rename from test-data/optional-union-int-float.json rename to test-data/core-types/optional-union-int-float.json diff --git a/test-data/optional-union-str-int.json b/test-data/core-types/optional-union-str-int.json similarity index 100% rename from test-data/optional-union-str-int.json rename to test-data/core-types/optional-union-str-int.json diff --git a/test-data/recursive-file-tree.json b/test-data/core-types/recursive-file-tree.json similarity index 100% rename from test-data/recursive-file-tree.json rename to test-data/core-types/recursive-file-tree.json diff --git a/test-data/top-level-bool.json b/test-data/core-types/top-level-bool.json similarity index 100% rename from test-data/top-level-bool.json rename to test-data/core-types/top-level-bool.json diff --git a/test-data/top-level-float.json b/test-data/core-types/top-level-float.json similarity index 100% rename from test-data/top-level-float.json rename to test-data/core-types/top-level-float.json diff --git a/test-data/top-level-int.json b/test-data/core-types/top-level-int.json similarity index 100% rename from test-data/top-level-int.json rename to test-data/core-types/top-level-int.json diff --git a/test-data/top-level-null.json b/test-data/core-types/top-level-null.json similarity index 100% rename from test-data/top-level-null.json rename to test-data/core-types/top-level-null.json diff --git a/test-data/top-level-string.json b/test-data/core-types/top-level-string.json similarity index 100% rename from test-data/top-level-string.json rename to test-data/core-types/top-level-string.json diff --git a/test-data/tree.json b/test-data/core-types/tree.json similarity index 100% rename from test-data/tree.json rename to test-data/core-types/tree.json diff --git a/test-data/union-int-float.json b/test-data/core-types/union-int-float.json similarity index 100% rename from test-data/union-int-float.json rename to test-data/core-types/union-int-float.json diff --git a/test-data/union-object-array.json b/test-data/core-types/union-object-array.json similarity index 100% rename from test-data/union-object-array.json rename to test-data/core-types/union-object-array.json diff --git a/test-data/union-str-int.json b/test-data/core-types/union-str-int.json similarity index 100% rename from test-data/union-str-int.json rename to test-data/core-types/union-str-int.json diff --git a/test-data/union-str-object.json b/test-data/core-types/union-str-object.json similarity index 100% rename from test-data/union-str-object.json rename to test-data/core-types/union-str-object.json diff --git a/test-data/deno-config.json b/test-data/deno/deno-config.json similarity index 100% rename from test-data/deno-config.json rename to test-data/deno/deno-config.json diff --git a/test-data/discord-webhook.json b/test-data/discord/discord-webhook.json similarity index 100% rename from test-data/discord-webhook.json rename to test-data/discord/discord-webhook.json diff --git a/test-data/docker-compose.yml b/test-data/docker/docker-compose.yml similarity index 100% rename from test-data/docker-compose.yml rename to test-data/docker/docker-compose.yml diff --git a/test-data/docker-daemon.json b/test-data/docker/docker-daemon.json similarity index 100% rename from test-data/docker-daemon.json rename to test-data/docker/docker-daemon.json diff --git a/test-data/elasticsearch-search-response.json b/test-data/elastic/elasticsearch-search-response.json similarity index 100% rename from test-data/elasticsearch-search-response.json rename to test-data/elastic/elasticsearch-search-response.json diff --git a/test-data/filebeat.yml b/test-data/elastic/filebeat.yml similarity index 100% rename from test-data/filebeat.yml rename to test-data/elastic/filebeat.yml diff --git a/test-data/eslintrc-react.json b/test-data/eslint/eslintrc-react.json similarity index 100% rename from test-data/eslintrc-react.json rename to test-data/eslint/eslintrc-react.json diff --git a/test-data/gcp-deployment-manager.yaml b/test-data/gcp/gcp-deployment-manager.yaml similarity index 100% rename from test-data/gcp-deployment-manager.yaml rename to test-data/gcp/gcp-deployment-manager.yaml diff --git a/test-data/config-file.json b/test-data/generic/config-file.json similarity index 100% rename from test-data/config-file.json rename to test-data/generic/config-file.json diff --git a/test-data/ecommerce-api-response.json b/test-data/generic/ecommerce-api-response.json similarity index 100% rename from test-data/ecommerce-api-response.json rename to test-data/generic/ecommerce-api-response.json diff --git a/test-data/massive.json b/test-data/generic/massive.json similarity index 100% rename from test-data/massive.json rename to test-data/generic/massive.json diff --git a/test-data/root-case-clash.json b/test-data/generic/root-case-clash.json similarity index 100% rename from test-data/root-case-clash.json rename to test-data/generic/root-case-clash.json diff --git a/test-data/test-report.json b/test-data/generic/test-report.json similarity index 100% rename from test-data/test-report.json rename to test-data/generic/test-report.json diff --git a/test-data/geojson-feature-collection.json b/test-data/geojson/geojson-feature-collection.json similarity index 100% rename from test-data/geojson-feature-collection.json rename to test-data/geojson/geojson-feature-collection.json diff --git a/test-data/geojson-polygon.json b/test-data/geojson/geojson-polygon.json similarity index 100% rename from test-data/geojson-polygon.json rename to test-data/geojson/geojson-polygon.json diff --git a/test-data/gh-actions-codeql.yml b/test-data/github/gh-actions-codeql.yml similarity index 100% rename from test-data/gh-actions-codeql.yml rename to test-data/github/gh-actions-codeql.yml diff --git a/test-data/gh-actions-main.yml b/test-data/github/gh-actions-main.yml similarity index 100% rename from test-data/gh-actions-main.yml rename to test-data/github/gh-actions-main.yml diff --git a/test-data/gh-actions-release.yml b/test-data/github/gh-actions-release.yml similarity index 100% rename from test-data/gh-actions-release.yml rename to test-data/github/gh-actions-release.yml diff --git a/test-data/gh-actions-stale.yml b/test-data/github/gh-actions-stale.yml similarity index 100% rename from test-data/gh-actions-stale.yml rename to test-data/github/gh-actions-stale.yml diff --git a/test-data/github-api-repo.json b/test-data/github/github-api-repo.json similarity index 100% rename from test-data/github-api-repo.json rename to test-data/github/github-api-repo.json diff --git a/test-data/github-pr-webhook.json b/test-data/github/github-pr-webhook.json similarity index 100% rename from test-data/github-pr-webhook.json rename to test-data/github/github-pr-webhook.json diff --git a/test-data/github-webhook-push.json b/test-data/github/github-webhook-push.json similarity index 100% rename from test-data/github-webhook-push.json rename to test-data/github/github-webhook-push.json diff --git a/test-data/gitlab-ci.yml b/test-data/gitlab/gitlab-ci.yml similarity index 100% rename from test-data/gitlab-ci.yml rename to test-data/gitlab/gitlab-ci.yml diff --git a/test-data/golangci-lint.yml b/test-data/golangci/golangci-lint.yml similarity index 100% rename from test-data/golangci-lint.yml rename to test-data/golangci/golangci-lint.yml diff --git a/test-data/grafana-dashboard.json b/test-data/grafana/grafana-dashboard.json similarity index 100% rename from test-data/grafana-dashboard.json rename to test-data/grafana/grafana-dashboard.json diff --git a/test-data/graphql-response.json b/test-data/graphql/graphql-response.json similarity index 100% rename from test-data/graphql-response.json rename to test-data/graphql/graphql-response.json diff --git a/test-data/jest-config.json b/test-data/jest/jest-config.json similarity index 100% rename from test-data/jest-config.json rename to test-data/jest/jest-config.json diff --git a/test-data/json-schema-meta.json b/test-data/json-schema/json-schema-meta.json similarity index 100% rename from test-data/json-schema-meta.json rename to test-data/json-schema/json-schema-meta.json diff --git a/test-data/basic-notebook.ipynb b/test-data/jupyter/basic-notebook.ipynb similarity index 100% rename from test-data/basic-notebook.ipynb rename to test-data/jupyter/basic-notebook.ipynb diff --git a/test-data/data-analysis.ipynb b/test-data/jupyter/data-analysis.ipynb similarity index 100% rename from test-data/data-analysis.ipynb rename to test-data/jupyter/data-analysis.ipynb diff --git a/test-data/jwt-claims.json b/test-data/jwt/jwt-claims.json similarity index 100% rename from test-data/jwt-claims.json rename to test-data/jwt/jwt-claims.json diff --git a/test-data/kibana-dashboard.json b/test-data/kibana/kibana-dashboard.json similarity index 100% rename from test-data/kibana-dashboard.json rename to test-data/kibana/kibana-dashboard.json diff --git a/test-data/k8s-configmap.yaml b/test-data/kubernetes/k8s-configmap.yaml similarity index 100% rename from test-data/k8s-configmap.yaml rename to test-data/kubernetes/k8s-configmap.yaml diff --git a/test-data/k8s-cronjob.yaml b/test-data/kubernetes/k8s-cronjob.yaml similarity index 100% rename from test-data/k8s-cronjob.yaml rename to test-data/kubernetes/k8s-cronjob.yaml diff --git a/test-data/k8s-daemonset.yaml b/test-data/kubernetes/k8s-daemonset.yaml similarity index 100% rename from test-data/k8s-daemonset.yaml rename to test-data/kubernetes/k8s-daemonset.yaml diff --git a/test-data/k8s-deployment.yaml b/test-data/kubernetes/k8s-deployment.yaml similarity index 100% rename from test-data/k8s-deployment.yaml rename to test-data/kubernetes/k8s-deployment.yaml diff --git a/test-data/k8s-hpa.yaml b/test-data/kubernetes/k8s-hpa.yaml similarity index 100% rename from test-data/k8s-hpa.yaml rename to test-data/kubernetes/k8s-hpa.yaml diff --git a/test-data/k8s-ingress.yaml b/test-data/kubernetes/k8s-ingress.yaml similarity index 100% rename from test-data/k8s-ingress.yaml rename to test-data/kubernetes/k8s-ingress.yaml diff --git a/test-data/k8s-job.yaml b/test-data/kubernetes/k8s-job.yaml similarity index 100% rename from test-data/k8s-job.yaml rename to test-data/kubernetes/k8s-job.yaml diff --git a/test-data/k8s-secret.yaml b/test-data/kubernetes/k8s-secret.yaml similarity index 100% rename from test-data/k8s-secret.yaml rename to test-data/kubernetes/k8s-secret.yaml diff --git a/test-data/k8s-service.yaml b/test-data/kubernetes/k8s-service.yaml similarity index 100% rename from test-data/k8s-service.yaml rename to test-data/kubernetes/k8s-service.yaml diff --git a/test-data/k8s-statefulset.yaml b/test-data/kubernetes/k8s-statefulset.yaml similarity index 100% rename from test-data/k8s-statefulset.yaml rename to test-data/kubernetes/k8s-statefulset.yaml diff --git a/test-data/kubernetes-pod-spec.json b/test-data/kubernetes/kubernetes-pod-spec.json similarity index 100% rename from test-data/kubernetes-pod-spec.json rename to test-data/kubernetes/kubernetes-pod-spec.json diff --git a/test-data/nodemon.json b/test-data/nodemon/nodemon.json similarity index 100% rename from test-data/nodemon.json rename to test-data/nodemon/nodemon.json diff --git a/test-data/package-json.json b/test-data/npm/package-json.json similarity index 100% rename from test-data/package-json.json rename to test-data/npm/package-json.json diff --git a/test-data/openai-chat-completion.json b/test-data/openai/openai-chat-completion.json similarity index 100% rename from test-data/openai-chat-completion.json rename to test-data/openai/openai-chat-completion.json diff --git a/test-data/openapi-spec.json b/test-data/openapi/openapi-spec.json similarity index 100% rename from test-data/openapi-spec.json rename to test-data/openapi/openapi-spec.json diff --git a/test-data/openapi-v3.json b/test-data/openapi/openapi-v3.json similarity index 100% rename from test-data/openapi-v3.json rename to test-data/openapi/openapi-v3.json diff --git a/test-data/opentelemetry-traces.json b/test-data/opentelemetry/opentelemetry-traces.json similarity index 100% rename from test-data/opentelemetry-traces.json rename to test-data/opentelemetry/opentelemetry-traces.json diff --git a/test-data/pnpm-lock.yaml b/test-data/pnpm/pnpm-lock.yaml similarity index 100% rename from test-data/pnpm-lock.yaml rename to test-data/pnpm/pnpm-lock.yaml diff --git a/test-data/poetry.lock b/test-data/poetry/poetry.lock similarity index 100% rename from test-data/poetry.lock rename to test-data/poetry/poetry.lock diff --git a/test-data/pyproject.toml b/test-data/poetry/pyproject.toml similarity index 100% rename from test-data/pyproject.toml rename to test-data/poetry/pyproject.toml diff --git a/test-data/prettierrc.json b/test-data/prettier/prettierrc.json similarity index 100% rename from test-data/prettierrc.json rename to test-data/prettier/prettierrc.json diff --git a/test-data/prometheus-metrics.json b/test-data/prometheus/prometheus-metrics.json similarity index 100% rename from test-data/prometheus-metrics.json rename to test-data/prometheus/prometheus-metrics.json diff --git a/test-data/prometheus.yml b/test-data/prometheus/prometheus.yml similarity index 100% rename from test-data/prometheus.yml rename to test-data/prometheus/prometheus.yml diff --git a/test-data/pubspec.yaml b/test-data/pub/pubspec.yaml similarity index 100% rename from test-data/pubspec.yaml rename to test-data/pub/pubspec.yaml diff --git a/test-data/python-logging-config.json b/test-data/python/python-logging-config.json similarity index 100% rename from test-data/python-logging-config.json rename to test-data/python/python-logging-config.json diff --git a/test-data/rubocop.yml b/test-data/rubocop/rubocop.yml similarity index 100% rename from test-data/rubocop.yml rename to test-data/rubocop/rubocop.yml diff --git a/test-data/sarif-security-report.json b/test-data/sarif/sarif-security-report.json similarity index 100% rename from test-data/sarif-security-report.json rename to test-data/sarif/sarif-security-report.json diff --git a/test-data/schema-org-product.json b/test-data/schema-org/schema-org-product.json similarity index 100% rename from test-data/schema-org-product.json rename to test-data/schema-org/schema-org-product.json diff --git a/test-data/serverless.yml b/test-data/serverless/serverless.yml similarity index 100% rename from test-data/serverless.yml rename to test-data/serverless/serverless.yml diff --git a/test-data/slack-block-kit.json b/test-data/slack/slack-block-kit.json similarity index 100% rename from test-data/slack-block-kit.json rename to test-data/slack/slack-block-kit.json diff --git a/test-data/stripe-invoice.json b/test-data/stripe/stripe-invoice.json similarity index 100% rename from test-data/stripe-invoice.json rename to test-data/stripe/stripe-invoice.json diff --git a/test-data/stripe-payment-intent.json b/test-data/stripe/stripe-payment-intent.json similarity index 100% rename from test-data/stripe-payment-intent.json rename to test-data/stripe/stripe-payment-intent.json diff --git a/test-data/stripe-subscription.json b/test-data/stripe/stripe-subscription.json similarity index 100% rename from test-data/stripe-subscription.json rename to test-data/stripe/stripe-subscription.json diff --git a/test-data/stylelintrc.json b/test-data/stylelint/stylelintrc.json similarity index 100% rename from test-data/stylelintrc.json rename to test-data/stylelint/stylelintrc.json diff --git a/test-data/sublime-project.json b/test-data/sublime/sublime-project.json similarity index 100% rename from test-data/sublime-project.json rename to test-data/sublime/sublime-project.json diff --git a/test-data/main.tf.json b/test-data/terraform/main.tf.json similarity index 100% rename from test-data/main.tf.json rename to test-data/terraform/main.tf.json diff --git a/test-data/terraform.tfstate b/test-data/terraform/terraform.tfstate similarity index 100% rename from test-data/terraform.tfstate rename to test-data/terraform/terraform.tfstate diff --git a/test-data/topojson-world.json b/test-data/topojson/topojson-world.json similarity index 100% rename from test-data/topojson-world.json rename to test-data/topojson/topojson-world.json diff --git a/test-data/twitter-tweet.json b/test-data/twitter/twitter-tweet.json similarity index 100% rename from test-data/twitter-tweet.json rename to test-data/twitter/twitter-tweet.json diff --git a/test-data/tsconfig-react.json b/test-data/typescript/tsconfig-react.json similarity index 100% rename from test-data/tsconfig-react.json rename to test-data/typescript/tsconfig-react.json diff --git a/test-data/tsconfig.json b/test-data/typescript/tsconfig.json similarity index 100% rename from test-data/tsconfig.json rename to test-data/typescript/tsconfig.json diff --git a/test-data/vcpkg.json b/test-data/vcpkg/vcpkg.json similarity index 100% rename from test-data/vcpkg.json rename to test-data/vcpkg/vcpkg.json diff --git a/test-data/vega-lite-bar-chart.json b/test-data/vega/vega-lite-bar-chart.json similarity index 100% rename from test-data/vega-lite-bar-chart.json rename to test-data/vega/vega-lite-bar-chart.json diff --git a/test-data/vega-scatter-plot.json b/test-data/vega/vega-scatter-plot.json similarity index 100% rename from test-data/vega-scatter-plot.json rename to test-data/vega/vega-scatter-plot.json diff --git a/test-data/vscode-launch.json b/test-data/vscode/vscode-launch.json similarity index 100% rename from test-data/vscode-launch.json rename to test-data/vscode/vscode-launch.json diff --git a/test-data/vscode-settings.json b/test-data/vscode/vscode-settings.json similarity index 100% rename from test-data/vscode-settings.json rename to test-data/vscode/vscode-settings.json diff --git a/test-data/atom.xml b/test-data/web-standards/atom.xml similarity index 100% rename from test-data/atom.xml rename to test-data/web-standards/atom.xml diff --git a/test-data/sitemap.xml b/test-data/web-standards/sitemap.xml similarity index 100% rename from test-data/sitemap.xml rename to test-data/web-standards/sitemap.xml diff --git a/test-data/web-manifest.json b/test-data/web-standards/web-manifest.json similarity index 100% rename from test-data/web-manifest.json rename to test-data/web-standards/web-manifest.json diff --git a/test-data/youtube-video.json b/test-data/youtube/youtube-video.json similarity index 100% rename from test-data/youtube-video.json rename to test-data/youtube/youtube-video.json diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 4ae634b..058c028 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -11,3 +11,5 @@ publish = false serde = { version = "1", features = ["derive"] } serde_json = "1" tokio = { version = "1", features = ["process"] } + +jsoncodegen = { path = "../core" } diff --git a/test-utils/src/lib.rs b/test-utils/src/lib.rs index 5c42f55..837ba41 100644 --- a/test-utils/src/lib.rs +++ b/test-utils/src/lib.rs @@ -1,3 +1,4 @@ +use jsoncodegen::{schema::Schema, type_graph::TypeGraph}; use serde::Deserialize; use serde_json::Value; use std::{ @@ -59,19 +60,18 @@ where let output_filepath = workspace_dir.join("output.json"); fs::File::create(&output_filepath).expect("Failed to create output file"); + let input_json_value: Value = serde_json::from_reader(fs::File::open(input_filepath).expect( + &format!("Failed to open input file :: {}", input_filepath.display()), + )) + .expect("Failed to parse input JSON"); + let codegen_output_filepath = workspace_dir.join(&manifest.template.codegen_output); - codegen( - serde_json::from_reader(fs::File::open(input_filepath).expect(&format!( - "Failed to open input file :: {}", - input_filepath.display() - ))) - .expect("Failed to parse input JSON"), - &mut fs::File::create(&codegen_output_filepath).expect(&format!( - "Failed to create file :: {}", - codegen_output_filepath.display() - )), - ) - .expect("Failed to run codegen"); + let mut output_file = fs::File::create(&codegen_output_filepath).expect(&format!( + "Failed to create file :: {}", + codegen_output_filepath.display() + )); + + codegen(input_json_value.clone(), &mut output_file).expect("Failed to run codegen"); const CNT_INPUT: &str = "/input.json"; const CNT_OUTPUT: &str = "/output.json"; @@ -116,25 +116,46 @@ where let input_content = fs::read_to_string(input_filepath).unwrap_or_else(|_| "".to_string()); - assert!( - cmd_output.status.success(), - "Run failed for: {name}\n\n--- input.json ---\n{input_content}\n\n--- {} ---\n{generated_code}\n\n--- stdout ---\n{}\n--- stderr ---\n{}", - codegen_output_filepath.display(), - String::from_utf8_lossy(&cmd_output.stdout), - String::from_utf8_lossy(&cmd_output.stderr) - ); + if !cmd_output.status.success() { + let schema = Schema::from(input_json_value.clone()); + let type_graph = TypeGraph::from(schema.clone()); + + let codegen_output_filepath = codegen_output_filepath.display(); + + let stdout = String::from_utf8_lossy(&cmd_output.stdout); + let stderr = String::from_utf8_lossy(&cmd_output.stderr); + + panic!( + "Run failed for: {name}\n\n\ + --- input.json ---\n\ + {input_content}\n\n\ + --- schema ---\n\ + {schema}\n\n\ + {schema:#?}\n\n\ + --- type graph ---\n\ + {type_graph}\n\n\ + {type_graph:#?}\n\n\ + --- {codegen_output_filepath} ---\n\ + {generated_code}\n\n\ + --- stdout ---\n\ + {stdout}\n\n\ + --- stderr ---\n\ + {stderr}", + ); + } - let output_json: Value = serde_json::from_reader( + let output_json_value: Value = serde_json::from_reader( fs::File::open(&output_filepath).expect("Failed to open output file"), ) .expect("Failed to parse output JSON"); - let expected_json: Value = - serde_json::from_reader(fs::File::open(input_filepath).expect("Failed to open input file")) - .expect("Failed to parse expected JSON"); assert!( - json_equiv(&output_json, &expected_json), - "Mismatch for: {name}\n\nExpected:\n{expected_json:#?}\n\nActual:\n{output_json:#?}" + json_equiv(&output_json_value, &input_json_value), + "Mismatch for: {name}\n\n\ + --- expected ---\n\ + {input_json_value:#?}\n\n\ + --- actual ---\n\ + {output_json_value:#?}" ); // TODO: workspace_dir doesn't get removed if there is a panic in above lines of code