From 580bcde7a085cf8d39ab393a20bffb0d3cdabb3e Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Sun, 23 Aug 2020 11:17:01 +0800 Subject: [PATCH] refactor: reset project path --- scie-grammar/src/inter/mod.rs | 23 +++++++++++-------- .../test-cases}/first-mate/README.md | 0 .../fixtures/apply-end-pattern-last.json | 0 .../first-mate/fixtures/c-plus-plus.json | 0 .../test-cases}/first-mate/fixtures/c.json | 0 .../first-mate/fixtures/coffee-script.json | 0 .../first-mate/fixtures/content-name.json | 0 .../test-cases}/first-mate/fixtures/css.json | 0 .../first-mate/fixtures/forever.json | 0 .../first-mate/fixtures/git-commit.json | 0 .../first-mate/fixtures/hello.json | 0 .../first-mate/fixtures/html-erb.json | 0 .../first-mate/fixtures/html-rails.json | 0 .../test-cases}/first-mate/fixtures/html.json | 0 .../first-mate/fixtures/hyperlink.json | 0 .../first-mate/fixtures/imaginary.json | 0 .../include-external-repository-rule.json | 0 .../first-mate/fixtures/infinite-loop.json | 0 .../test-cases}/first-mate/fixtures/java.json | 0 .../first-mate/fixtures/javascript-regex.json | 0 .../first-mate/fixtures/javascript.json | 0 .../test-cases}/first-mate/fixtures/json.json | 0 .../first-mate/fixtures/latex.json | 0 .../first-mate/fixtures/loops.json | 0 .../first-mate/fixtures/makefile.json | 0 .../first-mate/fixtures/multiline.json | 0 .../first-mate/fixtures/nested-captures.json | 0 .../fixtures/objective-c-plus-plus.json | 0 .../first-mate/fixtures/objective-c.json | 0 .../test-cases}/first-mate/fixtures/php.json | 0 .../first-mate/fixtures/python-regex.json | 0 .../first-mate/fixtures/python.json | 0 .../first-mate/fixtures/ruby-on-rails.json | 0 .../test-cases}/first-mate/fixtures/ruby.json | 0 .../test-cases}/first-mate/fixtures/scss.json | 0 .../test-cases}/first-mate/fixtures/sql.json | 0 .../test-cases}/first-mate/fixtures/text.json | 0 .../first-mate/fixtures/thrift.json | 0 .../test-cases}/first-mate/fixtures/todo.json | 0 .../test-cases}/first-mate/tests.json | 0 .../onigtests/fixtures/onigasm-issue3.js | 0 .../fixtures/php-onigasm-issue17.php | 0 .../onigtests/fixtures/test-issue11.ts | 0 .../test-cases}/onigtests/fixtures/test.cs | 0 .../onigtests/fixtures/typescript.js | 0 45 files changed, 13 insertions(+), 10 deletions(-) rename {test-cases => scie-grammar/test-cases}/first-mate/README.md (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/apply-end-pattern-last.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/c-plus-plus.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/c.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/coffee-script.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/content-name.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/css.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/forever.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/git-commit.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/hello.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/html-erb.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/html-rails.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/html.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/hyperlink.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/imaginary.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/include-external-repository-rule.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/infinite-loop.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/java.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/javascript-regex.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/javascript.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/json.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/latex.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/loops.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/makefile.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/multiline.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/nested-captures.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/objective-c-plus-plus.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/objective-c.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/php.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/python-regex.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/python.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/ruby-on-rails.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/ruby.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/scss.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/sql.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/text.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/thrift.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/fixtures/todo.json (100%) rename {test-cases => scie-grammar/test-cases}/first-mate/tests.json (100%) rename {test-cases => scie-grammar/test-cases}/onigtests/fixtures/onigasm-issue3.js (100%) rename {test-cases => scie-grammar/test-cases}/onigtests/fixtures/php-onigasm-issue17.php (100%) rename {test-cases => scie-grammar/test-cases}/onigtests/fixtures/test-issue11.ts (100%) rename {test-cases => scie-grammar/test-cases}/onigtests/fixtures/test.cs (100%) rename {test-cases => scie-grammar/test-cases}/onigtests/fixtures/typescript.js (100%) diff --git a/scie-grammar/src/inter/mod.rs b/scie-grammar/src/inter/mod.rs index 19c67cb..effa25f 100644 --- a/scie-grammar/src/inter/mod.rs +++ b/scie-grammar/src/inter/mod.rs @@ -176,10 +176,12 @@ impl IRawGrammar { #[cfg(test)] mod tests { - use crate::inter::{IRawCaptures, IRawRepository, IRawRule, InjectionMap}; + use crate::inter::{IRawCaptures, IRawRule, InjectionMap}; use serde::{Deserialize, Serialize}; use std::fs; use std::path::Path; + use std::fs::File; + use std::io::Read; #[derive(Serialize, Deserialize, Debug, Clone)] struct Captures { @@ -319,13 +321,14 @@ mod tests { .len(); assert_eq!(3, pattern_len) } - // - // #[test] - // fn should_convert_json_file() { - // let path = Path::new("../../../../extensions/json/syntaxes/JSON.tmLanguage.json"); - // for entry in fs::read_dir(path).expect("Unable to list") { - // let entry = entry.expect("unable to get entry"); - // println!("{}", entry.path().display()); - // } - // } + + #[test] + fn should_convert_json_file() { + let path = "test-cases/first-mate/fixtures/c.json"; + let mut file = File::open(path).unwrap(); + let mut data = String::new(); + file.read_to_string(&mut data).unwrap(); + + let p: IRawRule = serde_json::from_str(&data).unwrap(); + } } diff --git a/test-cases/first-mate/README.md b/scie-grammar/test-cases/first-mate/README.md similarity index 100% rename from test-cases/first-mate/README.md rename to scie-grammar/test-cases/first-mate/README.md diff --git a/test-cases/first-mate/fixtures/apply-end-pattern-last.json b/scie-grammar/test-cases/first-mate/fixtures/apply-end-pattern-last.json similarity index 100% rename from test-cases/first-mate/fixtures/apply-end-pattern-last.json rename to scie-grammar/test-cases/first-mate/fixtures/apply-end-pattern-last.json diff --git a/test-cases/first-mate/fixtures/c-plus-plus.json b/scie-grammar/test-cases/first-mate/fixtures/c-plus-plus.json similarity index 100% rename from test-cases/first-mate/fixtures/c-plus-plus.json rename to scie-grammar/test-cases/first-mate/fixtures/c-plus-plus.json diff --git a/test-cases/first-mate/fixtures/c.json b/scie-grammar/test-cases/first-mate/fixtures/c.json similarity index 100% rename from test-cases/first-mate/fixtures/c.json rename to scie-grammar/test-cases/first-mate/fixtures/c.json diff --git a/test-cases/first-mate/fixtures/coffee-script.json b/scie-grammar/test-cases/first-mate/fixtures/coffee-script.json similarity index 100% rename from test-cases/first-mate/fixtures/coffee-script.json rename to scie-grammar/test-cases/first-mate/fixtures/coffee-script.json diff --git a/test-cases/first-mate/fixtures/content-name.json b/scie-grammar/test-cases/first-mate/fixtures/content-name.json similarity index 100% rename from test-cases/first-mate/fixtures/content-name.json rename to scie-grammar/test-cases/first-mate/fixtures/content-name.json diff --git a/test-cases/first-mate/fixtures/css.json b/scie-grammar/test-cases/first-mate/fixtures/css.json similarity index 100% rename from test-cases/first-mate/fixtures/css.json rename to scie-grammar/test-cases/first-mate/fixtures/css.json diff --git a/test-cases/first-mate/fixtures/forever.json b/scie-grammar/test-cases/first-mate/fixtures/forever.json similarity index 100% rename from test-cases/first-mate/fixtures/forever.json rename to scie-grammar/test-cases/first-mate/fixtures/forever.json diff --git a/test-cases/first-mate/fixtures/git-commit.json b/scie-grammar/test-cases/first-mate/fixtures/git-commit.json similarity index 100% rename from test-cases/first-mate/fixtures/git-commit.json rename to scie-grammar/test-cases/first-mate/fixtures/git-commit.json diff --git a/test-cases/first-mate/fixtures/hello.json b/scie-grammar/test-cases/first-mate/fixtures/hello.json similarity index 100% rename from test-cases/first-mate/fixtures/hello.json rename to scie-grammar/test-cases/first-mate/fixtures/hello.json diff --git a/test-cases/first-mate/fixtures/html-erb.json b/scie-grammar/test-cases/first-mate/fixtures/html-erb.json similarity index 100% rename from test-cases/first-mate/fixtures/html-erb.json rename to scie-grammar/test-cases/first-mate/fixtures/html-erb.json diff --git a/test-cases/first-mate/fixtures/html-rails.json b/scie-grammar/test-cases/first-mate/fixtures/html-rails.json similarity index 100% rename from test-cases/first-mate/fixtures/html-rails.json rename to scie-grammar/test-cases/first-mate/fixtures/html-rails.json diff --git a/test-cases/first-mate/fixtures/html.json b/scie-grammar/test-cases/first-mate/fixtures/html.json similarity index 100% rename from test-cases/first-mate/fixtures/html.json rename to scie-grammar/test-cases/first-mate/fixtures/html.json diff --git a/test-cases/first-mate/fixtures/hyperlink.json b/scie-grammar/test-cases/first-mate/fixtures/hyperlink.json similarity index 100% rename from test-cases/first-mate/fixtures/hyperlink.json rename to scie-grammar/test-cases/first-mate/fixtures/hyperlink.json diff --git a/test-cases/first-mate/fixtures/imaginary.json b/scie-grammar/test-cases/first-mate/fixtures/imaginary.json similarity index 100% rename from test-cases/first-mate/fixtures/imaginary.json rename to scie-grammar/test-cases/first-mate/fixtures/imaginary.json diff --git a/test-cases/first-mate/fixtures/include-external-repository-rule.json b/scie-grammar/test-cases/first-mate/fixtures/include-external-repository-rule.json similarity index 100% rename from test-cases/first-mate/fixtures/include-external-repository-rule.json rename to scie-grammar/test-cases/first-mate/fixtures/include-external-repository-rule.json diff --git a/test-cases/first-mate/fixtures/infinite-loop.json b/scie-grammar/test-cases/first-mate/fixtures/infinite-loop.json similarity index 100% rename from test-cases/first-mate/fixtures/infinite-loop.json rename to scie-grammar/test-cases/first-mate/fixtures/infinite-loop.json diff --git a/test-cases/first-mate/fixtures/java.json b/scie-grammar/test-cases/first-mate/fixtures/java.json similarity index 100% rename from test-cases/first-mate/fixtures/java.json rename to scie-grammar/test-cases/first-mate/fixtures/java.json diff --git a/test-cases/first-mate/fixtures/javascript-regex.json b/scie-grammar/test-cases/first-mate/fixtures/javascript-regex.json similarity index 100% rename from test-cases/first-mate/fixtures/javascript-regex.json rename to scie-grammar/test-cases/first-mate/fixtures/javascript-regex.json diff --git a/test-cases/first-mate/fixtures/javascript.json b/scie-grammar/test-cases/first-mate/fixtures/javascript.json similarity index 100% rename from test-cases/first-mate/fixtures/javascript.json rename to scie-grammar/test-cases/first-mate/fixtures/javascript.json diff --git a/test-cases/first-mate/fixtures/json.json b/scie-grammar/test-cases/first-mate/fixtures/json.json similarity index 100% rename from test-cases/first-mate/fixtures/json.json rename to scie-grammar/test-cases/first-mate/fixtures/json.json diff --git a/test-cases/first-mate/fixtures/latex.json b/scie-grammar/test-cases/first-mate/fixtures/latex.json similarity index 100% rename from test-cases/first-mate/fixtures/latex.json rename to scie-grammar/test-cases/first-mate/fixtures/latex.json diff --git a/test-cases/first-mate/fixtures/loops.json b/scie-grammar/test-cases/first-mate/fixtures/loops.json similarity index 100% rename from test-cases/first-mate/fixtures/loops.json rename to scie-grammar/test-cases/first-mate/fixtures/loops.json diff --git a/test-cases/first-mate/fixtures/makefile.json b/scie-grammar/test-cases/first-mate/fixtures/makefile.json similarity index 100% rename from test-cases/first-mate/fixtures/makefile.json rename to scie-grammar/test-cases/first-mate/fixtures/makefile.json diff --git a/test-cases/first-mate/fixtures/multiline.json b/scie-grammar/test-cases/first-mate/fixtures/multiline.json similarity index 100% rename from test-cases/first-mate/fixtures/multiline.json rename to scie-grammar/test-cases/first-mate/fixtures/multiline.json diff --git a/test-cases/first-mate/fixtures/nested-captures.json b/scie-grammar/test-cases/first-mate/fixtures/nested-captures.json similarity index 100% rename from test-cases/first-mate/fixtures/nested-captures.json rename to scie-grammar/test-cases/first-mate/fixtures/nested-captures.json diff --git a/test-cases/first-mate/fixtures/objective-c-plus-plus.json b/scie-grammar/test-cases/first-mate/fixtures/objective-c-plus-plus.json similarity index 100% rename from test-cases/first-mate/fixtures/objective-c-plus-plus.json rename to scie-grammar/test-cases/first-mate/fixtures/objective-c-plus-plus.json diff --git a/test-cases/first-mate/fixtures/objective-c.json b/scie-grammar/test-cases/first-mate/fixtures/objective-c.json similarity index 100% rename from test-cases/first-mate/fixtures/objective-c.json rename to scie-grammar/test-cases/first-mate/fixtures/objective-c.json diff --git a/test-cases/first-mate/fixtures/php.json b/scie-grammar/test-cases/first-mate/fixtures/php.json similarity index 100% rename from test-cases/first-mate/fixtures/php.json rename to scie-grammar/test-cases/first-mate/fixtures/php.json diff --git a/test-cases/first-mate/fixtures/python-regex.json b/scie-grammar/test-cases/first-mate/fixtures/python-regex.json similarity index 100% rename from test-cases/first-mate/fixtures/python-regex.json rename to scie-grammar/test-cases/first-mate/fixtures/python-regex.json diff --git a/test-cases/first-mate/fixtures/python.json b/scie-grammar/test-cases/first-mate/fixtures/python.json similarity index 100% rename from test-cases/first-mate/fixtures/python.json rename to scie-grammar/test-cases/first-mate/fixtures/python.json diff --git a/test-cases/first-mate/fixtures/ruby-on-rails.json b/scie-grammar/test-cases/first-mate/fixtures/ruby-on-rails.json similarity index 100% rename from test-cases/first-mate/fixtures/ruby-on-rails.json rename to scie-grammar/test-cases/first-mate/fixtures/ruby-on-rails.json diff --git a/test-cases/first-mate/fixtures/ruby.json b/scie-grammar/test-cases/first-mate/fixtures/ruby.json similarity index 100% rename from test-cases/first-mate/fixtures/ruby.json rename to scie-grammar/test-cases/first-mate/fixtures/ruby.json diff --git a/test-cases/first-mate/fixtures/scss.json b/scie-grammar/test-cases/first-mate/fixtures/scss.json similarity index 100% rename from test-cases/first-mate/fixtures/scss.json rename to scie-grammar/test-cases/first-mate/fixtures/scss.json diff --git a/test-cases/first-mate/fixtures/sql.json b/scie-grammar/test-cases/first-mate/fixtures/sql.json similarity index 100% rename from test-cases/first-mate/fixtures/sql.json rename to scie-grammar/test-cases/first-mate/fixtures/sql.json diff --git a/test-cases/first-mate/fixtures/text.json b/scie-grammar/test-cases/first-mate/fixtures/text.json similarity index 100% rename from test-cases/first-mate/fixtures/text.json rename to scie-grammar/test-cases/first-mate/fixtures/text.json diff --git a/test-cases/first-mate/fixtures/thrift.json b/scie-grammar/test-cases/first-mate/fixtures/thrift.json similarity index 100% rename from test-cases/first-mate/fixtures/thrift.json rename to scie-grammar/test-cases/first-mate/fixtures/thrift.json diff --git a/test-cases/first-mate/fixtures/todo.json b/scie-grammar/test-cases/first-mate/fixtures/todo.json similarity index 100% rename from test-cases/first-mate/fixtures/todo.json rename to scie-grammar/test-cases/first-mate/fixtures/todo.json diff --git a/test-cases/first-mate/tests.json b/scie-grammar/test-cases/first-mate/tests.json similarity index 100% rename from test-cases/first-mate/tests.json rename to scie-grammar/test-cases/first-mate/tests.json diff --git a/test-cases/onigtests/fixtures/onigasm-issue3.js b/scie-grammar/test-cases/onigtests/fixtures/onigasm-issue3.js similarity index 100% rename from test-cases/onigtests/fixtures/onigasm-issue3.js rename to scie-grammar/test-cases/onigtests/fixtures/onigasm-issue3.js diff --git a/test-cases/onigtests/fixtures/php-onigasm-issue17.php b/scie-grammar/test-cases/onigtests/fixtures/php-onigasm-issue17.php similarity index 100% rename from test-cases/onigtests/fixtures/php-onigasm-issue17.php rename to scie-grammar/test-cases/onigtests/fixtures/php-onigasm-issue17.php diff --git a/test-cases/onigtests/fixtures/test-issue11.ts b/scie-grammar/test-cases/onigtests/fixtures/test-issue11.ts similarity index 100% rename from test-cases/onigtests/fixtures/test-issue11.ts rename to scie-grammar/test-cases/onigtests/fixtures/test-issue11.ts diff --git a/test-cases/onigtests/fixtures/test.cs b/scie-grammar/test-cases/onigtests/fixtures/test.cs similarity index 100% rename from test-cases/onigtests/fixtures/test.cs rename to scie-grammar/test-cases/onigtests/fixtures/test.cs diff --git a/test-cases/onigtests/fixtures/typescript.js b/scie-grammar/test-cases/onigtests/fixtures/typescript.js similarity index 100% rename from test-cases/onigtests/fixtures/typescript.js rename to scie-grammar/test-cases/onigtests/fixtures/typescript.js -- GitLab