Esempio n. 1
0
            public void LimitTest()
            {
                List <string> files = new List <string>();

                files.AddRange(new string[] {
                    "Main.hx",
                    "src\\com\\module\\example\\ExampleModule.hx",
                    "src\\com\\module\\example\\IExampleModule.hx",
                    "src\\com\\module\\test\\ITestModule.hx",
                    "src\\com\\module\\test\\TestModule.hx"
                });
                var results = SearchUtil.getMatchedItems(files, "m", "\\", 1);

                Assert.AreEqual(results.Count, 1);

                results = SearchUtil.getMatchedItems(files, "m", "\\", 1);
                Assert.Greater(results.Count, 0);
            }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        private void FillListBox()
        {
            List <String> matchedFiles;

            if (this.textBox.Text.Length > 0)
            {
                matchedFiles = SearchUtil.getMatchedItems(this.openedFiles, this.textBox.Text, "\\", 0);
                if (matchedFiles.Capacity > 0)
                {
                    matchedFiles.Add(ITEM_SPACER);
                }
                matchedFiles.AddRange(SearchUtil.getMatchedItems(this.projectFiles, this.textBox.Text, "\\", this.MAX_ITEMS));
            }
            else
            {
                matchedFiles = openedFiles;
            }
            foreach (String file in matchedFiles)
            {
                this.listBox.Items.Add(file);
            }
        }
Esempio n. 3
0
            public void TestTest()
            {
                List <string> files = new List <string>();

                files.AddRange(new string[] {
                    "src\\StaticClass.hx",
                    "src\\com\\module\\ITestModule.hx",
                    "src\\com\\module\\TestModule.hx",
                    "src\\com\\module\\example\\ExampleModule.hx",
                    "src\\com\\module\\example\\IExampleModule.hx",
                    "src\\com\\module\\test\\ITestModule.hx",
                    "src\\com\\module\\test\\TestModule.hx"
                });

                var results = SearchUtil.getMatchedItems(files, "test\\test", "\\", 0);

                //"test\\TestModule.hx" should be first, because it has test in the path and also in the beginning of the file name
                Assert.AreEqual("src\\com\\module\\test\\TestModule.hx", results[0]);
                Assert.AreEqual("src\\com\\module\\test\\ITestModule.hx", results[1]);
                //these have no test in the path
                Assert.AreEqual("src\\com\\module\\TestModule.hx", results[2]);
                Assert.AreEqual("src\\com\\module\\ITestModule.hx", results[3]);
            }
Esempio n. 4
0
            public void IClassTest()
            {
                List <string> files = new List <string>();

                files.AddRange(new string[] {
                    "hexannotation\\hex\\annotation\\AnnotationData.hx",
                    "hexannotation\\hex\\annotation\\AnnotationReader.hx",
                    "hexannotation\\hex\\annotation\\ArgumentData.hx",
                    "hexannotation\\hex\\annotation\\ClassAnnotationData.hx",
                    "hexannotation\\hex\\annotation\\ClassAnnotationDataProvider.hx",
                    "hexannotation\\hex\\annotation\\IClassAnnotationDataProvider.hx",
                    "hexannotation\\hex\\annotation\\MethodAnnotationData.hx",
                    "hexannotation\\hex\\annotation\\PropertyAnnotationData.hx",
                    "src\\Main.hx",
                    "src\\StaticClass.hx"
                });
                var results = SearchUtil.getMatchedItems(files, "iclass", "\\", 2);

                //since the file name starts with iclass, it should be prefered over "src\\StaticClass.hx", which has
                Assert.AreEqual("hexannotation\\hex\\annotation\\IClassAnnotationDataProvider.hx", results[0]);

                //however, "src\\StaticClass.hx" should be second, because it is only slightly off.
                Assert.AreEqual("src\\StaticClass.hx", results[1]);
            }
Esempio n. 5
0
            public void SimpleTest()
            {
                List <string> files = new List <string>();

                files.AddRange(new string[] {
                    "src\\Main.hx",
                    "src\\StaticClass.hx",
                    "src\\com\\Test.xml",
                    "Package.bat",
                    "Run.bat",
                    "Test.hxproj",
                    "bin\\.empty",
                    "bin\\Test.n",
                    "src\\com\\module\\ITestModule.hx",
                    "src\\com\\module\\TestModule.hx",
                    "src\\com\\module\\example\\ExampleModule.hx",
                    "src\\com\\module\\example\\IExampleModule.hx",
                    "src\\com\\module\\test\\ITestModule.hx",
                    "src\\com\\module\\test\\TestModule.hx"
                });
                var results = SearchUtil.getMatchedItems(files, "m", "\\", 1);

                Assert.AreEqual("src\\Main.hx", results[0]); //shortest and also starts with an "m", so should be first
            }