Skip to content

Instantly share code, notes, and snippets.

@Et7f3
Created October 3, 2019 23:19
Show Gist options
  • Save Et7f3/c36059408ffb2f648618e798b54d1d6f to your computer and use it in GitHub Desktop.
Save Et7f3/c36059408ffb2f648618e798b54d1d6f to your computer and use it in GitHub Desktop.
esy_lock unit tests
def esy_lock(name, bool)
puts (!!name.match(/(^|\/)(\w+\.)?esy.lock$/) == bool)
end
esy_lock("esy.lock", true)
esy_lock(".esy.lock", false)
esy_lock("h.esy.lock", true)
esy_lock("esy.lock", true)
esy_lock("/esy.lock", true)
esy_lock("/.esy.lock", false)
esy_lock("/h.esy.lock", true)
esy_lock("/esy.lock", true)
esy_lock("/one/path/esy.lock", true)
esy_lock("/one/path/.esy.lock", false)
esy_lock("/one/path/h.esy.lock", true)
esy_lock("/one/path/esy.lock", true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment