mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-01 05:24:15 +00:00
updated error messages
This commit is contained in:
parent
4b4ad47312
commit
5f6d259e5d
3 changed files with 28 additions and 24 deletions
|
|
@ -3841,8 +3841,7 @@ struct HeaderOutput<'a> {
|
|||
fn ensure_roc_file<'a>(filename: &PathBuf, src_bytes: &[u8]) -> Result<(), LoadingProblem<'a>> {
|
||||
match filename.extension() {
|
||||
Some(ext) => {
|
||||
let roc_ext = std::ffi::OsStr::new("roc");
|
||||
if roc_ext != ext {
|
||||
if ext != ROC_FILE_EXTENSION {
|
||||
return Err(LoadingProblem::FileProblem {
|
||||
filename: filename.clone(),
|
||||
error: io::ErrorKind::Unsupported,
|
||||
|
|
|
|||
|
|
@ -1213,10 +1213,10 @@ fn non_roc_file_extension() {
|
|||
|
||||
let expected = indoc!(
|
||||
r"
|
||||
── EXPECTED ROC FILE in tmp/non_roc_file_extension/main.md ─────────────────────
|
||||
── NOT A ROC FILE in tmp/non_roc_file_extension/main.md ────────────────────────
|
||||
|
||||
I am expecting a roc application file with either `.roc` or no
|
||||
extension. Instead I found a file with extension `.md`"
|
||||
I expected a file with extension `.roc` or without extension.
|
||||
Instead I received a file with extension `.md`."
|
||||
);
|
||||
let color_start = String::from_utf8(vec![27, 91, 51, 54, 109]).unwrap();
|
||||
let color_end = String::from_utf8(vec![27, 91, 48, 109]).unwrap();
|
||||
|
|
@ -1245,13 +1245,15 @@ fn roc_file_no_extension() {
|
|||
|
||||
let expected = indoc!(
|
||||
r"
|
||||
── EXPECTED ROC FILE in tmp/roc_file_no_extension/main ─────────────────────────
|
||||
── NOT A ROC FILE in tmp/roc_file_no_extension/main ────────────────────────────
|
||||
|
||||
I am expecting a roc application file with either `.roc` or no
|
||||
extension and a shebang directive. Instead I found a file without an
|
||||
extension and without a shebang
|
||||
I expected a file with either:
|
||||
- extension `.roc`
|
||||
- no extension and a roc shebang as the first line, e.g.
|
||||
`#!/home/username/bin/roc_nightly/roc`
|
||||
|
||||
Consider starting the file with `#!` and the path to your roc binarya"
|
||||
The provided file did not start with a shebang `#!` containing the
|
||||
string `roc`. Is tmp/roc_file_no_extension/main a Roc file?"
|
||||
);
|
||||
let color_start = String::from_utf8(vec![27, 91, 51, 54, 109]).unwrap();
|
||||
let color_end = String::from_utf8(vec![27, 91, 48, 109]).unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue