Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/03_signals_and_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ Signal copper = ("copper-plate", 0);
Signal iron_limited = iron;
Signal copper_limited = copper / 3;

# Minimum determines capacity using conditional values
# Minimum determines capacity using conditional values
Signal can_make = ((iron_limited < copper_limited) : iron_limited)
+ ((copper_limited <= iron_limited) : copper_limited);
```
Expand Down
4 changes: 2 additions & 2 deletions doc/06_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,12 @@ func calc(Signal a, Signal b) { ... }

**Use conditional values (`:`) over multiplication:**
```facto
# Efficient one decider combinator
# Efficient: one decider combinator
func select(Signal cond, Signal a, Signal b) {
return ((cond != 0) : a) + ((cond == 0) : b);
}

# Less efficient extra arithmetic
# Less efficient: extra arithmetic
func select_old(Signal cond, Signal a, Signal b) {
return (cond != 0) * a + (cond == 0) * b;
}
Expand Down
2 changes: 1 addition & 1 deletion example_programs/tests/test_markdown_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def extract_facto_blocks(markdown_path: Path) -> list[tuple[str, int, str]]:

Returns: List of (code, line_number, first_30_chars) tuples
"""
content = markdown_path.read_text()
content = markdown_path.read_text(encoding="utf-8")
blocks = []

# Find all ```facto ... ``` blocks
Expand Down
5 changes: 3 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""

import json
import os

import click
import pytest
Expand Down Expand Up @@ -365,13 +366,13 @@ def test_compile_complex_program(self):
success, result, messages = compile_dsl_source(code)
assert success is True

@pytest.mark.skipif(os.name == "nt", reason="chmod permission test not reliable on Windows")
def test_read_file_error_unreadable_file(self, runner, tmp_path):
"""Cover lines 234-236: error handling when reading input file fails.

Click validates file readability before our code runs, so we test
that Click properly reports unreadable files.
"""
import os
import stat

# Create a file, then make it unreadable
Expand All @@ -395,12 +396,12 @@ def test_read_file_error_nonexistent_file(self, runner, tmp_path):
result = runner.invoke(main, [str(tmp_path / "nonexistent.facto")])
assert result.exit_code != 0

@pytest.mark.skipif(os.name == "nt", reason="chmod permission test not reliable on Windows")
def test_write_file_error_unwritable_directory(self, runner, tmp_path):
"""Cover lines 261-264: error handling when writing output file fails.

Tests the exception handler for file write errors.
"""
import os
import stat

# Create a valid input file
Expand Down
Loading