Skip to content

Commit 933acb5

Browse files
committed
Refactor tests for improved readability and consistency
- Updated formatting in `chat_comprehensive_plan_test.rs` for better alignment and clarity. - Simplified command arguments in multiple test files for consistency. - Enhanced assertions in various tests to improve readability. - Consolidated tool registration calls in `chat_ovsm_executor_integration_test.rs` for cleaner code. - Streamlined message processing logic in `chat_sendable_textarea_test.rs` and other related tests. - Removed unnecessary lines and improved logging messages across several test files. - Ensured consistent use of Rust's idiomatic style throughout the test suite.
1 parent 260da79 commit 933acb5

File tree

134 files changed

+5658
-3104
lines changed

Some content is hidden

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

134 files changed

+5658
-3104
lines changed

Cargo.lock

Lines changed: 3 additions & 6 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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ opt-level = 0
139139
debug = true
140140

141141
[patch.crates-io]
142-
curve25519-dalek = { git = "https://github.com/dalek-cryptography/curve25519-dalek", tag = "3.2.0" }
143142
crunchy = { path = "vendor/crunchy" }
144143

145144
# Custom scripts for development and deployment

crates/ovsm/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ sha2 = "0.10"
6161
base64 = "0.22.1"
6262
bs58 = "0.5.1"
6363
hex = "0.4"
64+
url = "2.5"
65+
csv = "1.3"
6466

6567
[dev-dependencies]
6668
proptest = "1.4"

crates/ovsm/src/lexer/sexpr_scanner.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,13 @@ impl SExprScanner {
241241
let text: String = self.source[self.start..self.current].iter().collect();
242242

243243
if is_float {
244-
let value: f64 = text.parse()
244+
let value: f64 = text
245+
.parse()
245246
.map_err(|_| Error::ParseError(format!("Invalid float: {}", text)))?;
246247
self.add_token(TokenKind::Float(value));
247248
} else {
248-
let value: i64 = text.parse()
249+
let value: i64 = text
250+
.parse()
249251
.map_err(|_| Error::ParseError(format!("Invalid integer: {}", text)))?;
250252
self.add_token(TokenKind::Integer(value));
251253
}
@@ -256,7 +258,13 @@ impl SExprScanner {
256258
fn scan_identifier_or_keyword(&mut self) -> Result<()> {
257259
// In Common Lisp, identifiers can contain *, +, -, /, etc as suffixes
258260
// First, scan the base identifier
259-
while self.peek().is_alphanumeric() || self.peek() == '_' || self.peek() == '-' || self.peek() == '?' || self.peek() == '!' || self.peek() == '&' {
261+
while self.peek().is_alphanumeric()
262+
|| self.peek() == '_'
263+
|| self.peek() == '-'
264+
|| self.peek() == '?'
265+
|| self.peek() == '!'
266+
|| self.peek() == '&'
267+
{
260268
self.advance();
261269
}
262270

@@ -327,7 +335,8 @@ impl SExprScanner {
327335

328336
fn add_token(&mut self, kind: TokenKind) {
329337
let lexeme: String = self.source[self.start..self.current].iter().collect();
330-
self.tokens.push(Token::new(kind, lexeme, self.line, self.column));
338+
self.tokens
339+
.push(Token::new(kind, lexeme, self.line, self.column));
331340
}
332341
}
333342

crates/ovsm/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ pub mod tools;
280280
// Re-export main types
281281
pub use error::{Error, Result};
282282
pub use lexer::{SExprScanner, Token, TokenKind};
283-
pub use parser::{BinaryOp, Expression, SExprParser, Program, Statement, UnaryOp};
283+
pub use parser::{BinaryOp, Expression, Program, SExprParser, Statement, UnaryOp};
284284
pub use runtime::{Environment, LispEvaluator, Value};
285285
pub use tools::{Tool, ToolRegistry};
286286

crates/ovsm/src/parser/mod.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,19 @@ mod paren_fixer;
77
mod sexpr_parser;
88

99
pub use ast::{
10-
Argument, BinaryOp, Expression, Program, ProgramMetadata, Statement, UnaryOp,
10+
AccumulationClause,
11+
Argument,
12+
BinaryOp,
13+
ConditionClause,
14+
ExitClause,
15+
Expression,
16+
IterationClause,
1117
// Loop macro structures
12-
LoopData, IterationClause, AccumulationClause, ConditionClause, ExitClause,
18+
LoopData,
19+
Program,
20+
ProgramMetadata,
21+
Statement,
22+
UnaryOp,
1323
};
1424
pub use paren_fixer::ParenFixer;
1525
pub use sexpr_parser::SExprParser;

crates/ovsm/src/parser/paren_fixer.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
//! parentheses in OVSM code, similar to error recovery in modern compilers.
55
66
use crate::error::Result;
7-
use crate::Scanner;
87
use crate::parser::SExprParser;
8+
use crate::Scanner;
99

1010
/// Attempts to automatically fix missing or mismatched parentheses
1111
pub struct ParenFixer {
@@ -178,10 +178,9 @@ impl ParenFixer {
178178
let mut close_count = 0;
179179
let mut in_string = false;
180180
let mut escape_next = false;
181-
let mut in_comment = false;
182181

183182
for line in &self.lines {
184-
in_comment = false; // Comments are line-based
183+
let mut in_comment = false; // Comments are line-based
185184

186185
for ch in line.chars() {
187186
// Handle escape sequences
@@ -360,7 +359,10 @@ impl ParenFixer {
360359

361360
match fixed_result {
362361
Ok(fixed) => (fixed, report),
363-
Err(_) => (self.source.clone(), Some("⚠️ Could not auto-correct parentheses".to_string())),
362+
Err(_) => (
363+
self.source.clone(),
364+
Some("⚠️ Could not auto-correct parentheses".to_string()),
365+
),
364366
}
365367
}
366368
}

0 commit comments

Comments
 (0)