Migrate tests from hand-rolled IO to LSpec framework
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 42/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- build-system, testing
Hướng nghiên cứu
Bắt đầu bằng cách đọc test/ParserTest.lean, test/NfaTest.lean, test/MatcherTest.lean và test/Main.lean để hiểu 67 bài kiểm thử hiện có và các điểm vào hiện tại của chúng. Sau đó xem xét lakefile.toml và các yêu cầu tích hợp LSpec. Công việc được hoàn tất khi các bài kiểm thử sử dụng các suite LSpec được nhóm, lake test cung cấp kết quả có cấu trúc và phần scaffolding IO thủ công được loại bỏ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The current test suite uses hand-rolled IO Unit functions with manual IO.println "✓" / throw "✗" for pass/fail reporting. This reimplements scaffolding that existing Lean 4 testing frameworks already provide.
Current state
- 67 tests across
ParserTest.lean,NfaTest.lean,MatcherTest.lean - Each test is a
def testFoo : IO Unitthat manually prints results test/Main.leancalls each test function sequentially- No structured output, no test counts, no failure summaries
Recommended approach: LSpec
LSpec is the standard Lean 4 testing framework. Tests become declarative assertions:
import LSpec
import Lck.Regex.Parser
def parserSuite := [
test "single char" (parse "a" = Except.ok (Regex.char 'a')),
test "reversed range fails" (parse "[z-a]" matches Except.error _),
test "empty pattern" (parse "" = Except.error RegexError.emptyPattern)
]
def main := lspecIO $ .ofList [
("parser", parserSuite),
("matcher", matcherSuite)
]
Benefits:
- Eliminates ~200 lines of boilerplate (manual IO.println/throw per test)
- Structured pass/fail output with counts and summaries
- Standard
lake testintegration viatestDriver - Consistent with Lean ecosystem conventions
Other approaches worth considering
#guard: Built-in compile-time assertions (#guard parse "a" = Except.ok (Regex.char 'a')). Zero boilerplate, failures are compilation errors. Good for simple invariants alongside LSpec.- SlimCheck/Plausible: Property-based testing for discovering edge cases automatically. Could complement LSpec for properties like "any regex that parses successfully can be compiled to an NFA".
Migration plan
- Add LSpec dependency to
lakefile.toml - Convert each
testFoo : IO Unitto an LSpectest "name" (assertion) - Group tests into suites by module
- Wire up
main := lspecIO $ .ofList [...] - Configure
testDriverin lakefile - Remove manual IO scaffolding
- Ngôn ngữ chính
- Lean
- Star
- 2
- Fork
- 1
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của lambdaclass/lambda_compiler_kit
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 50/100
Tất cả issue của lambdaclass/lambda_compiler_kit
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
freedomofpress/dangerzone#1562 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
carbon-design-system/ibm-products#9907 ·
-
intake mcp-intake needs-ac needs-human-review priority:medium type:feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Ikalus1988/MisakaNet#2102 · 2 bình luận ·
-
onnx-ir re-exports ModelProto and GraphProto but not NodeProto, AttributeProto and AttributeType Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
llvm/lighthouse#283 ·