You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2d277fd
Browse filesBrowse the repository at this point in the historyBrowse files
std::fs::write(tmp.join("main.c"),"#include <stdio.h>\n\n/** Adds two integers. */\nint add(int a, int b) {\n return a + b;\n}\n\nint main(void) {\n printf(\"%d\\n\", add(1, 2));\n return 0;\n}\n").unwrap();
std::fs::write(tmp.join("Main.elm"),"module Main exposing (main)\n\nimport Html exposing (text)\n\n-- Adds two numbers.\nadd : Int -> Int -> Int\nadd a b =\n a + b\n\nmain =\n text (String.fromInt (add 1 2))\n").unwrap();
19
34
20
-
// 初始化 elm 项目
21
-
let _ = Command::new("sh")
22
-
.args(["-c","echo 'Y' | elm init"])
23
-
.current_dir(&tmp)
24
-
.output();
25
-
26
35
let output = Command::new("elm")
27
36
.args(["make","Main.elm","--output=/dev/null"])
28
37
.current_dir(&tmp)
29
38
.output()
30
39
.expect("elm 不可用");
31
40
32
-
assert!(output.status.success(),"有效 Elm 代码应通过编译: {:?}", output);
std::fs::write(tmp.join("Main.elm"),"module Main exposing (main)\n\nimport Html exposing (text)\n\nbroken : Int -> Int -> Int\nbroken a b =\n a + b + notDefinedAnywhere\n\nmain =\n text (String.fromInt (broken 1 2))\n").unwrap();
std::fs::write(tmp.join("Main.elm"),"module Main exposing (main)\n\nimport Html exposing (text)\n\nundocumented : Int -> Int\nundocumented a =\n a * 2\n\n-- Has docs.\ndocumented : Int -> Int\ndocumented a =\n a + 1\n\nmain =\n text (String.fromInt (undocumented 5 + documented 3))\n").unwrap();
0 commit comments