This repository has been archived by the owner on Oct 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #528 from kleintom/file_operator
File operator
- Loading branch information
Showing
12 changed files
with
125 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
17 | ||
18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fins |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[DXR] | ||
enabled_plugins = pygmentize | ||
es_index = dxr_test_{format}_{tree}_{unique} | ||
es_alias = dxr_test_{format}_{tree} | ||
es_catalog_index = dxr_test_catalog | ||
|
||
[code] | ||
source_folder = code | ||
build_command = | ||
clean_command = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from nose.tools import raises | ||
|
||
from dxr.testing import DxrInstanceTestCase | ||
|
||
|
||
class PathAndFileFilterTests(DxrInstanceTestCase): | ||
"""Basic tests for functionality of the 'path:' and 'file:' filters""" | ||
|
||
def test_basic_path_results(self): | ||
"""Check that a 'path:' result includes both file and folder matches.""" | ||
self.found_files_eq('path:fish', ['fish1', 'fishy_folder/fish2', | ||
'fishy_folder/gill', 'folder/fish3', | ||
'folder/fish4']) | ||
|
||
def test_basic_file_results(self): | ||
"""Check that a 'file:' result includes only file matches.""" | ||
self.found_files_eq('file:fish', ['fish1', 'fishy_folder/fish2', | ||
'folder/fish3', 'folder/fish4']) | ||
|
||
def test_path_and_file_line_promotion(self): | ||
"""Make sure promotion of a 'path:' or 'file:' filter to a LINE query | ||
works. | ||
""" | ||
self.found_files_eq('path:fish fins', ['folder/fish3']) | ||
self.found_files_eq('file:fish fins', ['folder/fish3']) | ||
|
||
# This fails because we currently intentionally exclude folder paths from | ||
# FILE query results - remove the @raises line when that's changed. (Of | ||
# course then other tests here will need to be updated as well.) | ||
@raises(AssertionError) | ||
def test_empty_folder_path_results(self): | ||
"""Check that 'path:' results include empty folders.""" | ||
self.found_files_eq('path:empty_folder', ['empty_folder']) | ||
|
||
def test_basic_wildcard(self): | ||
"""Test basic wildcard functionality.""" | ||
# 'path:' and 'file:' currently have the same underlying wildcard | ||
# support, so we're spreading out the basic wildcard testing over both. | ||
self.found_files_eq('path:fish?_fo*er', | ||
['fishy_folder/fish2', 'fishy_folder/gill']) | ||
|
||
self.found_files_eq('file:fish[14]', ['fish1', 'folder/fish4']) |