h4cc / h4cc/Finder

Is Finder.with_directory_regex working correctly ?

Open
#14 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Elixir
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Here is my tree

```
lowks@lowkster ~/src/elixir/Radpath $ tree test
test
├── fixtures
│   ├── dome.zip
│   ├── file1.txt
│   ├── file2.txt
│   ├── file3.log
│   ├── gogo
│   ├── testdir1
│   │   └── testfile1.txt
│   ├── testdir2
│   │   └── testfile2.txt
│   └── testdir3
│   └── testfile3.txt
├── radpath_test.exs
└── test_helper.exs
```

I did a regex on directory using this, where the regex should basically return everything in 'test':

```
iex(1)> result = Finder.new() |>
...(1)> Finder.with_directory_regex(Regex.compile!("^\/.*")) |>
...(1)> Finder.only_directories |>
...(1)> Finder.find("test") |>
...(1)> Enum.to_list |>
...(1)> Enum.sort
[]
```

and using the normal without 'with_directory_regex', here is the output:

```
iex(2)> result = Finder.new() |>
...(2)> Finder.only_directories |>
...(2)> Finder.find("test") |>
...(2)> Enum.to_list |>
...(2)> Enum.sort
["test/fixtures", "test/fixtures/gogo", "test/fixtures/testdir1",
"test/fixtures/testdir2", "test/fixtures/testdir3"]
```

and

```
iex(3)> Regex.run(~r/^\/.*/, "/home/lowks/test")
["/home/lowks/test"]
```

Is there a problem with the way I am using it ?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.