/
test_wild_search.rb
40 lines (35 loc) · 1.25 KB
/
test_wild_search.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- encoding: utf-8 -*-
# To test use
# rake TEST=test/test_wild_search.rb
require 'test/unit'
require 'code_zauker'
# See ri Test::Unit::Assertions
# for assertion documentation
class FileScannerBasicSearch < Test::Unit::TestCase
#This test can search very uinque things...
def test_foolish_wild1
fs=CodeZauker::FileScanner.new()
fs.load("./test/fixture/wildtest.txt")
files=fs.wsearch("Wild*West")
assert(files.include?("./test/fixture/wildtest.txt")== true,
"Expected file not found. Files found:#{files}")
assert(files.length==1)
end
def test_foolish_wild2
fs=CodeZauker::FileScanner.new()
fs.load("./test/fixture/wildtest.txt")
files=fs.wsearch("Wild*West*Movie")
assert(files.include?("./test/fixture/wildtest.txt")== true,
"Expected file not found. Files found:#{files}")
assert(files.length==1)
end
# Also unordered match will work
# So the negative match is difficult
def test_foolish_wild3
fs=CodeZauker::FileScanner.new()
fs.load("./test/fixture/wildtest.txt")
files=fs.wsearch("West*Wild*NotOnTheSameLineForSure")
assert(files.include?("./test/fixture/wildtest.txt")== false,
"Expected not matching wildtest.txt file. Matches:#{files}")
end
end