Skip to content

Commit ae7c934

Browse files
authored
Remove testlang and refactor tests (#1374)
This PR does ~two~ three things: 1. Add tests to the Solidity packages (cargo and npm) of functionality that was only tested in `testlang`. 2. Remove `testlang`. 3. Refactor tests to have a nicer tree-structure related to the topic being tested.
1 parent 059296d commit ae7c934

File tree

235 files changed

+764
-10738
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+764
-10738
lines changed

.cspell.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"struct",
3333
"structs",
3434
"tera",
35-
"testlang",
3635
"ufixed",
3736
"unparse",
3837
"usize"

Cargo.lock

Lines changed: 0 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ members = [
3838
"crates/solidity/testing/snapshots",
3939
"crates/solidity/testing/solc",
4040
"crates/solidity/testing/sourcify",
41-
42-
"crates/testlang/inputs/language",
43-
"crates/testlang/outputs/cargo/crate",
44-
"crates/testlang/outputs/cargo/tests",
45-
"crates/testlang/outputs/cargo/wasm",
46-
"crates/testlang/outputs/npm/package",
4741
]
4842

4943
[workspace.dependencies]
@@ -82,12 +76,6 @@ solidity_testing_snapshots = { path = "crates/solidity/testing/snapshots", versi
8276
solidity_testing_solc = { path = "crates/solidity/testing/solc", version = "1.2.1" }
8377
solidity_testing_sourcify = { path = "crates/solidity/testing/sourcify", version = "1.2.1" }
8478

85-
slang_testlang = { path = "crates/testlang/outputs/cargo/crate", version = "1.2.1" }
86-
testlang_cargo_tests = { path = "crates/testlang/outputs/cargo/tests", version = "1.2.1" }
87-
testlang_cargo_wasm = { path = "crates/testlang/outputs/cargo/wasm", version = "1.2.1" }
88-
testlang_language = { path = "crates/testlang/inputs/language", version = "1.2.1" }
89-
testlang_npm_package = { path = "crates/testlang/outputs/npm/package", version = "1.2.1" }
90-
9179
#
9280
# External
9381
#

crates/codegen/runner/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ codegen_testing = { workspace = true }
1515
infra_utils = { workspace = true }
1616
rayon = { workspace = true }
1717
solidity_language = { workspace = true }
18-
testlang_language = { workspace = true }
1918

2019
[lints]
2120
workspace = true

crates/codegen/runner/src/main.rs

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use infra_utils::cargo::CargoWorkspace;
99
use infra_utils::codegen::CodegenFileSystem;
1010
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
1111
use solidity_language::SolidityDefinition;
12-
use testlang_language::TestlangDefinition;
1312

1413
use crate::passes::generate_passes;
1514

@@ -63,30 +62,6 @@ fn main() {
6362
"solidity_npm_package",
6463
)
6564
},
66-
|| {
67-
generate_product(
68-
&mut CodegenFileSystem::default(),
69-
&TestlangDefinition::create(),
70-
"codegen_runtime_cargo_crate",
71-
"slang_testlang",
72-
)
73-
},
74-
|| {
75-
generate_product(
76-
&mut CodegenFileSystem::default(),
77-
&TestlangDefinition::create(),
78-
"codegen_runtime_cargo_wasm",
79-
"testlang_cargo_wasm",
80-
)
81-
},
82-
|| {
83-
generate_product(
84-
&mut CodegenFileSystem::default(),
85-
&TestlangDefinition::create(),
86-
"codegen_runtime_npm_package",
87-
"testlang_npm_package",
88-
)
89-
},
9065
]
9166
.par_iter()
9267
.for_each(|op| op().unwrap());
@@ -105,16 +80,16 @@ fn generate_solidity_tests() -> Result<()> {
10580
let snapshots_crate = CargoWorkspace::locate_source_crate("solidity_testing_snapshots")?;
10681
let tests_crate = CargoWorkspace::locate_source_crate("solidity_cargo_tests")?;
10782

108-
lang_def.generate_version_breaks(&tests_crate.join("src/generated"))?;
83+
lang_def.generate_version_breaks(&tests_crate.join("src/cst/generated"))?;
10984

11085
lang_def.generate_bindings_output_tests(
11186
&snapshots_crate.join("bindings_output"),
112-
&tests_crate.join("src/bindings_output/generated"),
87+
&tests_crate.join("src/bindings/bindings_output/generated"),
11388
)?;
11489

11590
lang_def.generate_cst_output_tests(
11691
&snapshots_crate.join("cst_output"),
117-
&tests_crate.join("src/cst_output/generated"),
92+
&tests_crate.join("src/cst/cst_output/generated"),
11893
)?;
11994

12095
lang_def.generate_binder_tests(

crates/codegen/testing/src/bindings_output.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn generate_bindings_output_tests(data_dir: &Path, output_dir: &Path) -> Res
1515

1616
for (group_name, test_names) in &tests {
1717
generate_unit_test_file(
18-
"crate::bindings_output::runner",
18+
"crate::bindings::bindings_output::runner",
1919
&mut fs,
2020
group_name,
2121
test_names,

crates/codegen/testing/src/cst_output.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn generate_cst_output_tests(data_dir: &Path, output_dir: &Path) -> Result<(
1515

1616
for (parser_name, test_names) in &parser_tests {
1717
generate_unit_test_file(
18-
"crate::cst_output::runner",
18+
"crate::cst::cst_output::runner",
1919
&mut fs,
2020
parser_name,
2121
test_names,

crates/infra/cli/src/toolchains/wasm/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub const WASM_TARGET: &str = "wasm32-wasip1";
1414
pub enum WasmPackage {
1515
Codegen,
1616
Solidity,
17-
Testlang,
1817
}
1918

2019
impl WasmPackage {
@@ -182,22 +181,20 @@ impl WasmPackage {
182181
match self {
183182
Self::Codegen => "codegen_runtime_cargo_wasm",
184183
Self::Solidity => "solidity_cargo_wasm",
185-
Self::Testlang => "testlang_cargo_wasm",
186184
}
187185
}
188186

189187
pub fn npm_crate(self) -> &'static str {
190188
match self {
191189
Self::Codegen => "codegen_runtime_npm_package",
192190
Self::Solidity => "solidity_npm_package",
193-
Self::Testlang => "testlang_npm_package",
194191
}
195192
}
196193

197194
fn runtime_dir(self) -> &'static str {
198195
match self {
199196
Self::Codegen => "src/runtime",
200-
Self::Solidity | Self::Testlang => "src/generated",
197+
Self::Solidity => "src/generated",
201198
}
202199
}
203200
}

crates/solidity/outputs/cargo/tests/src/binder/runner.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use slang_solidity::backend::passes::p4_resolve_references::Output;
1010
use slang_solidity::compilation::{CompilationUnit, InternalCompilationBuilder};
1111

1212
use super::renderer::binder_report;
13-
use crate::generated::VERSION_BREAKS;
14-
use crate::multi_part_file::{split_multi_file, MultiPart};
15-
use crate::resolver::TestsPathResolver;
13+
use crate::bindings::multi_part_file::{split_multi_file, MultiPart};
14+
use crate::compilation::resolver::TestsPathResolver;
15+
use crate::cst::generated::VERSION_BREAKS;
1616

1717
pub(crate) fn run(group_name: &str, test_name: &str) -> Result<()> {
1818
let test_dir = CargoWorkspace::locate_source_crate("solidity_testing_snapshots")?

crates/solidity/outputs/cargo/tests/src/binding_resolver.rs renamed to crates/solidity/outputs/cargo/tests/src/bindings/binding_resolver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use slang_solidity::bindings::{self, BindingGraph};
66
use slang_solidity::cst::{Cursor, Query, TerminalKind};
77
use slang_solidity::parser::Parser;
88

9-
use crate::resolver::TestsPathResolver;
9+
use crate::compilation::resolver::TestsPathResolver;
1010

1111
const TEST_VERSION: Version = Version::new(0, 8, 26);
1212

0 commit comments

Comments
 (0)