mirror of
https://github.com/github/codeql.git
synced 2026-05-03 12:45:27 +02:00
Add a test for ActionDispatch::underscore
This shows how the predicate behaves, as well as a case where it goes wrong.
This commit is contained in:
committed by
Harry Maclean
parent
9c67869875
commit
fa28e55645
@@ -38,3 +38,13 @@ actionDispatchControllerMethods
|
||||
| app/config/routes.rb:28:3:28:50 | call to match | app/controllers/photos_controller.rb:2:3:3:5 | show |
|
||||
| app/config/routes.rb:29:3:29:69 | call to match | app/controllers/photos_controller.rb:2:3:3:5 | show |
|
||||
| app/config/routes.rb:49:5:49:94 | call to post | app/controllers/users/notifications_controller.rb:3:5:4:7 | mark_as_read |
|
||||
underscore
|
||||
| Foo | foo |
|
||||
| Foo::Bar | foo/bar |
|
||||
| Foo::Bar::Baz | foo/bar/baz |
|
||||
| Foo::Bar::BazQuux | foo/bar/baz_quux |
|
||||
| FooBar | foo_bar |
|
||||
| FooBar::Baz | foo_bar/baz |
|
||||
| HTTPServerRequest | h_tT_p_server_request |
|
||||
| LotsOfCapitalLetters | lots_of_capital_letters |
|
||||
| invalid | invalid |
|
||||
|
||||
@@ -16,3 +16,11 @@ query predicate actionDispatchControllerMethods(
|
||||
) {
|
||||
m.getARoute() = r
|
||||
}
|
||||
|
||||
query predicate underscore(string input, string output) {
|
||||
output = ActionDispatch::underscore(input) and
|
||||
input in [
|
||||
"Foo", "FooBar", "Foo::Bar", "FooBar::Baz", "Foo::Bar::Baz", "Foo::Bar::BazQuux", "invalid",
|
||||
"HTTPServerRequest", "LotsOfCapitalLetters"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user