zeek/testing/btest/Baseline/policy.utils.paths/output
Jon Siwek 9b27a98e93 Add unit tests for utils/paths.bro with some changes
- rename extract_directory() to extract_path() (later seemed clearer)
  and made it work with more than just path string in FTP response msgs
- rename build_full_path() and absolute_path()
- compress_path() should now work with relative paths also
2011-07-18 20:05:16 -05:00

84 lines
1.9 KiB
Text

test compress_path()
===============================
Given : foo//bar
Expect: foo/bar
Result: foo/bar
Result: SUCCESS
===============================
Given : foo//bar/..
Expect: foo
Result: foo
Result: SUCCESS
===============================
Given : foo/bar/../..
Expect:
Result:
Result: SUCCESS
===============================
Given : foo//bar/../..
Expect:
Result:
Result: SUCCESS
===============================
Given : /foo/../bar
Expect: /bar
Result: /bar
Result: SUCCESS
===============================
Given : /foo/../bar/..
Expect: /
Result: /
Result: SUCCESS
===============================
Given : /foo/baz/../..
Expect: /
Result: /
Result: SUCCESS
===============================
Given : ../..
Expect: ../..
Result: ../..
Result: SUCCESS
===============================
Given : foo/../../..
Expect: ../..
Result: ../..
Result: SUCCESS
===============================
test extract_path()
===============================
Given : "/this/is/a/dir" is current directory
Expect: /this/is/a/dir
Result: /this/is/a/dir
Result: SUCCESS
===============================
Given : /this/is/a/dir is current directory
Expect: /this/is/a/dir
Result: /this/is/a/dir
Result: SUCCESS
===============================
Given : /this/is/a/dir\ is\ current\ directory
Expect: /this/is/a/dir\ is\ current\ directory
Result: /this/is/a/dir\ is\ current\ directory
Result: SUCCESS
===============================
Given : hey, /foo/bar/baz.bro is a cool script
Expect: /foo/bar/baz.bro
Result: /foo/bar/baz.bro
Result: SUCCESS
===============================
Given : here's two dirs: /foo/bar and /foo/baz
Expect: /foo/bar
Result: /foo/bar
Result: SUCCESS
===============================
test build_path_compressed()
===============================
/home/bro/policy/somefile.bro
/usr/local/bro/share/bro/somefile.bro
/usr/local/bro/somefile.bro
===============================
test build_full_path()
===============================
/home/bro//policy/somefile.bro
/usr/local/bro/share/bro/somefile.bro