File tree Expand file tree Collapse file tree 3 files changed +57
-5
lines changed
Expand file tree Collapse file tree 3 files changed +57
-5
lines changed Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [master, main]
6+ pull_request :
7+ branches : [master, main]
8+
9+ env :
10+ CARGO_TERM_COLOR : always
11+
12+ jobs :
13+ build :
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - uses : actions/checkout@v4
18+
19+ - name : Setup Rust
20+ uses : dtolnay/rust-action@stable
21+
22+ - name : Build
23+ run : cargo build --release
24+
25+ - name : Run cargo tests
26+ run : cargo test
27+
28+ - name : Setup Node.js
29+ uses : actions/setup-node@v4
30+ with :
31+ node-version : ' 20'
32+
33+ - name : Setup Python
34+ uses : actions/setup-python@v5
35+ with :
36+ python-version : ' 3.12'
37+
38+ - name : Run stdlib tests (JavaScript)
39+ run : |
40+ echo "Running stdlib tests with JavaScript target..."
41+ for file in stdlib/**/*.algoc; do
42+ echo "Testing: $file"
43+ cargo run --release -- test "$file" --target js
44+ done
45+
46+ - name : Run stdlib tests (Python)
47+ run : |
48+ echo "Running stdlib tests with Python target..."
49+ for file in stdlib/**/*.algoc; do
50+ echo "Testing: $file"
51+ cargo run --release -- test "$file" --target python
52+ done
Original file line number Diff line number Diff line change @@ -1877,7 +1877,7 @@ impl CodeGenerator for JavaScriptGenerator {
18771877 . collect ( ) ;
18781878
18791879 // Generate test runner if tests are included
1880- if self . include_tests && !test_names . is_empty ( ) {
1880+ if self . include_tests {
18811881 self . writeln ( "// Test Runner" ) ;
18821882 self . writeln ( "function run_tests() {" ) ;
18831883 self . indent ( ) ;
@@ -1947,7 +1947,7 @@ impl CodeGenerator for JavaScriptGenerator {
19471947 first = false ;
19481948 }
19491949 }
1950- if self . include_tests && !test_names . is_empty ( ) {
1950+ if self . include_tests {
19511951 if !first {
19521952 self . write ( ", " ) ;
19531953 }
@@ -1958,7 +1958,7 @@ impl CodeGenerator for JavaScriptGenerator {
19581958 self . writeln ( "}" ) ;
19591959
19601960 // Auto-run tests if this is the main module
1961- if self . include_tests && !test_names . is_empty ( ) {
1961+ if self . include_tests {
19621962 self . writeln ( "" ) ;
19631963 self . writeln ( "// Auto-run tests if executed directly" ) ;
19641964 self . writeln ( "if (typeof require !== 'undefined' && require.main === module) {" ) ;
Original file line number Diff line number Diff line change @@ -1458,7 +1458,7 @@ impl CodeGenerator for PythonGenerator {
14581458 . collect ( ) ;
14591459
14601460 // Generate test runner if tests are included
1461- if self . include_tests && !test_names . is_empty ( ) {
1461+ if self . include_tests {
14621462 self . writeln ( "# Test Runner" ) ;
14631463 self . writeln ( "def run_tests():" ) ;
14641464 self . indent ( ) ;
@@ -1502,7 +1502,7 @@ impl CodeGenerator for PythonGenerator {
15021502 // Main block
15031503 self . writeln ( "if __name__ == '__main__':" ) ;
15041504 self . indent ( ) ;
1505- if self . include_tests && !test_names . is_empty ( ) {
1505+ if self . include_tests {
15061506 self . writeln ( "import sys" ) ;
15071507 self . writeln ( "sys.exit(0 if run_tests() else 1)" ) ;
15081508 } else {
You can’t perform that action at this time.
0 commit comments