Skip to content

Commit 98e0a67

Browse files
committed
feat: add tester definition and basic test cases
1 parent d330a71 commit 98e0a67

File tree

17 files changed

+470
-2
lines changed

17 files changed

+470
-2
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ version = "0.1.0"
44
edition = "2024"
55

66
[dependencies]
7+
tester = { git = "https://github.com/stackclass/tester.git", tag = "v0.3.0"}

src/definition.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright (c) The StackClass Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
use std::sync::Arc;
16+
17+
use tester::{Case, Definition};
18+
19+
use crate::stages::{base::*, evaluating_expressions::*, parsing_expressions::*};
20+
21+
pub fn build() -> Definition {
22+
Definition {
23+
executable_name: "your_program.sh".to_string(),
24+
legacy_executable_name: Some("your_program.sh".to_string()),
25+
cases: vec![
26+
// Base Stages
27+
Case::new("ry8", Arc::new(ry8::test_eof)),
28+
Case::new("ol4", Arc::new(ol4::test_paren)),
29+
Case::new("oe8", Arc::new(oe8::test_brace)),
30+
// Parsing Expressions
31+
Case::new("sc2", Arc::new(sc2::test_parse_booleans)),
32+
Case::new("ra8", Arc::new(ra8::test_parse_numbers)),
33+
Case::new("th5", Arc::new(th5::test_parse_strings)),
34+
// Evaluating Expressions
35+
Case::new("iz6", Arc::new(iz6::test_evaluate_booleans)),
36+
Case::new("lv1", Arc::new(lv1::test_evaluate_literals)),
37+
Case::new("oq9", Arc::new(oq9::test_evaluate_parens)),
38+
],
39+
..Default::default()
40+
}
41+
}

src/main.rs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1-
fn main() {
2-
println!("Hello, world!");
1+
// Copyright (c) The StackClass Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
mod definition;
16+
mod stages;
17+
18+
use std::process::ExitCode;
19+
20+
fn main() -> ExitCode {
21+
// Collect all environment variables into a HashMap
22+
let env = std::env::vars().collect();
23+
// Build the definition from the definition module
24+
let definition = definition::build();
25+
26+
// Run the tester
27+
tester::run(env, definition)
328
}

src/stages/base/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) The StackClass Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
pub mod oe8;
16+
pub mod ol4;
17+
pub mod ry8;

src/stages/base/oe8.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) The StackClass Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
use tester::{CaseError, Harness};
16+
17+
pub fn test_brace(_harness: &Harness) -> Result<(), CaseError> {
18+
Ok(())
19+
}

src/stages/base/ol4.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) The StackClass Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
use tester::{CaseError, Harness};
16+
17+
pub fn test_paren(_harness: &Harness) -> Result<(), CaseError> {
18+
Ok(())
19+
}

src/stages/base/ry8.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) The StackClass Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
use tester::{CaseError, Harness};
16+
17+
pub fn test_eof(_harness: &Harness) -> Result<(), CaseError> {
18+
Ok(())
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) The StackClass Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
use tester::{CaseError, Harness};
16+
17+
pub fn test_evaluate_booleans(_harness: &Harness) -> Result<(), CaseError> {
18+
Ok(())
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) The StackClass Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
use tester::{CaseError, Harness};
16+
17+
pub fn test_evaluate_literals(_harness: &Harness) -> Result<(), CaseError> {
18+
Ok(())
19+
}

0 commit comments

Comments
 (0)