From 9dc2385c647b561e4ba739af63b7ef4203ad5928 Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Thu, 24 Jun 2021 18:24:12 +1000 Subject: [PATCH] Add `file_extensions` to Sublime syntax file (#878) --- Cargo.lock | 16 ++++++++++++++++ Cargo.toml | 1 + extras/just.sublime-syntax | 1 + tests/common.rs | 1 + tests/lib.rs | 1 + tests/sublime_syntax.rs | 7 +++++++ 6 files changed, 27 insertions(+) create mode 100644 tests/sublime_syntax.rs diff --git a/Cargo.lock b/Cargo.lock index 0e72dd1..ff59b76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -218,6 +218,7 @@ dependencies = [ "test-utilities", "unicode-width", "which", + "yaml-rust", ] [[package]] @@ -232,6 +233,12 @@ version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" +[[package]] +name = "linked-hash-map" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" + [[package]] name = "log" version = "0.4.14" @@ -617,3 +624,12 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] diff --git a/Cargo.toml b/Cargo.toml index dfc662b..fa15e96 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,6 +46,7 @@ features = ["derive"] executable-path = "1.0.0" pretty_assertions = "0.7.0" which = "4.0.0" +yaml-rust = "0.4.5" # Until github.com/rust-lang/cargo/pull/7333 makes it into stable, # this version-less dev-dependency will interfere with publishing diff --git a/extras/just.sublime-syntax b/extras/just.sublime-syntax index 8487439..d6ea9b3 100644 --- a/extras/just.sublime-syntax +++ b/extras/just.sublime-syntax @@ -2,6 +2,7 @@ --- # http://www.sublimetext.com/docs/syntax.html name: Just +file_extensions: [Justfile, just] scope: source.just contexts: main: diff --git a/tests/common.rs b/tests/common.rs index 43ce227..96d03d5 100644 --- a/tests/common.rs +++ b/tests/common.rs @@ -14,3 +14,4 @@ pub(crate) use just::unindent; pub(crate) use libc::{EXIT_FAILURE, EXIT_SUCCESS}; pub(crate) use test_utilities::{assert_stdout, tempdir, tmptree}; pub(crate) use which::which; +pub(crate) use yaml_rust::YamlLoader; diff --git a/tests/lib.rs b/tests/lib.rs index c4eb592..61b3f8d 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -26,4 +26,5 @@ mod search; mod shebang; mod shell; mod string; +mod sublime_syntax; mod working_directory; diff --git a/tests/sublime_syntax.rs b/tests/sublime_syntax.rs new file mode 100644 index 0000000..fb2a7de --- /dev/null +++ b/tests/sublime_syntax.rs @@ -0,0 +1,7 @@ +use crate::common::*; + +#[test] +fn parse() { + let yaml = fs::read_to_string("extras/just.sublime-syntax").unwrap(); + YamlLoader::load_from_str(&yaml).unwrap(); +}