Commit Graph

45 Commits

Author SHA1 Message Date
Manu MA bfc8ca285e
feat(engine): add trustedproxies and remoteIP (#2632)
Co-authored-by: Søren L. Hansen <soren@linux2go.dk>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
Co-authored-by: Javier Provecho Fernandez <javiertitan@gmail.com>
2021-04-06 11:37:25 +08:00
Dmitry Kutakov 31bbb10f34 Make silent debug info on tests (#1765)
* make silent log on tests

* fix coverage: check end-of-line at the end of debug msg
2019-02-18 10:10:45 +08:00
Dmitry Kutakov a768f064d5 fix many redirects (#1760) (#1764)
* fix many redirects (#1760)

* fix @thinkerou review
2019-02-18 09:35:08 +08:00
Dmitry Kutakov 4867ff9634 fix Context.Next() - recheck len of handlers every iteration (#1745)
* fix Context.Next() - recheck len of handlers every iteration

* add tests when Context.reset() can be called inside of handler

TestEngineHandleContext
TestContextResetInHandler
TestRouterStaticFSFileNotFound

* Context.Next() - format to while style
2019-01-18 09:57:06 +08:00
Sergey Ponomarev cfa092f4f0 Fix LoadHTML* tests (#1559)
Digging into the test code base I've found out that some of the tests for `LoadHTML*` methods are not reliable and efficient. They use timeouts to be sure that goroutine with the server has started. And even more, in old implementation, the server started only once – all the new instances silently failed due to the occupied network port.

Here is a short overview of the proposed changes: 
- it's not necessary to rely on timeouts, the server starts listening synchronously and returns control when it is ready
- once the server is run, it's stopped after a test passes
- dry out http server setup
- magic with empty closure return is eliminated 
- preserve router.RunTLS coverage with integration tests
2018-10-16 08:48:41 +08:00
Iskander (Alex) Sharipov 3f27866f80 simplify slice expressions: s[:] => s (#1541)
Found using https://go-critic.github.io/overview#unslice-ref
2018-09-12 21:21:26 +08:00
田欧 6159213462 unify test data (#1417)
mkdir a test data dir.
2018-08-12 23:38:31 +08:00
田欧 eeb57848ca update assert param(expect, actual) position (#1177) 2017-11-21 21:18:45 +08:00
田欧 1f377cb847 Add test cases for RunTLS and each mode (#1173)
* add RunTLS test cases and add debug/test mode cases

* add release mode cases
2017-11-21 09:27:57 +08:00
Bo-Yi Wu 6d071c1d36
Add load html file and func map.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-07-02 13:06:43 +08:00
Bo-Yi Wu a40699e07f
add FuncMap testing
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-07-02 12:38:05 +08:00
sope 35f5df63e6 add custom Delims support (#860)
* Revert "Merge pull request #753 from gin-gonic/bug"

This reverts commit 556287ff08, reversing
changes made to 32cab500ec.

* Revert "Merge pull request #744 from aviddiviner/logger-fix"

This reverts commit c3bfd69303, reversing
changes made to 9177f01c28.

* add custom Delims support

* add some test for Delims

* remove the empty line for import native package

* remove unuseful comments
2017-05-29 03:03:49 -05:00
Javier Provecho Fernandez 3c3526f1f1 fix test and build 2016-04-15 01:35:22 +02:00
Javier Provecho Fernandez 9e930b9bdd lint code 2016-04-15 01:16:46 +02:00
Albin Gilles 1f2e53dfd1 Fix typo on gin_test.go
Fixes #550, change a duplicate assert on the Path of the route by an assert on Handler name associated with the route.
2016-03-09 08:29:01 +01:00
Philipp Meinen 9fd8aff56e tests: make path assertions aware of vendoring
The path of a package can change in a situation where
dependency vendoring is in use.
This change modifies gin's unit tests to allow such paths.
2015-08-23 00:13:41 +02:00
Manu Mtz-Almeida a97c239b7a fixes unit tests 2015-08-16 16:36:47 +02:00
Manu Mtz-Almeida fc5e355724 BasePath is not longer an exported field, but a method instead 2015-07-08 04:27:23 +02:00
Manu Mtz-Almeida 638377655d Add unit tests for LoadHTML in debug mode 2015-07-04 20:06:40 +02:00
Manu Mtz-Almeida 1a7ab6e4d5 Fixes gin.Routes() tests 2015-06-18 17:17:22 +02:00
Manu Mtz-Almeida c7d2d82d01 gofmt 2015-06-07 04:26:30 +02:00
Manu Mtz-Almeida 45dd777693 List of routes 2015-06-07 04:20:39 +02:00
Manu Mtz-Almeida ee021d06ea More unit tests 2015-06-04 04:32:18 +02:00
Manu Mtz-Almeida 766493c916 Fixes all unit tests 2015-05-31 22:35:49 +02:00
Manu Mtz-Almeida 835f66fdc9 404 not found performance improvements
benchmark            old ns/op     new ns/op     delta
Benchmark404         737           249           -66.21%
Benchmark404Many     2330          454           -80.52%

benchmark            old allocs     new allocs     delta
Benchmark404         3              0              -100.00%
Benchmark404Many     10             0              -100.00%

benchmark            old bytes     new bytes     delta
Benchmark404         115           68            -40.87%
Benchmark404Many     235           57            -75.74%
2015-05-30 14:45:13 +02:00
Manu Mtz-Almeida 022304e7d9 Better API for RouteGroup.Handle() 2015-05-19 23:22:35 +02:00
Manu Mtz-Almeida 0cb52ccef7 Improves unit test coverage 2015-05-19 02:29:32 +02:00
Manu Mtz-Almeida 3066c35754 Renames RouterGroup.absolutePath to .BasePath 2015-05-16 18:08:19 +02:00
Manu Mtz-Almeida eb3e9293ed Renames []HandleFunc to HandlersChain 2015-05-07 11:30:01 +02:00
Manu Mtz-Almeida f212ae7728 Updates tree.go + fixes + unit tests 2015-05-05 16:37:33 +02:00
Manu Mtz-Almeida 0a192fb0fa Tons of unit tests 2015-04-09 12:15:02 +02:00
Manu Mtz-Almeida ac0ad2fed8 Improves unit tests 2015-04-08 02:58:35 +02:00
Manu Mtz-Almeida 615c62d736 Some cosmetic changes 2015-03-23 04:41:29 +01:00
Javier Provecho Fernandez 413d0f2296 Fix TestRouteNotOK2 with HTTP 405 2015-01-04 02:28:37 +01:00
Manu Mtz-Almeida 030706c39a Using absolutePath in static properly 2014-10-08 21:49:08 +02:00
Manu Mtz-Almeida 8e5397bfa0 Adds in-code license 2014-08-29 19:49:50 +02:00
Manu Mtz-Almeida 94f2f3f7eb Using test mode 2014-08-21 01:01:42 +02:00
Manu Mtz-Almeida d85245b5aa Improves unit tests
- Reusing much more code
- More coverage
- Cleanup
- Fixes some cases
2014-08-18 19:48:48 +02:00
Sasha Myasoedov 6abe841c1f Splited tests into separate files 2014-08-08 14:48:15 +03:00
Sasha Myasoedov 74ca5f3bd9 Added dummy tests for middleware 2014-07-28 13:05:23 +03:00
Sasha Myasoedov 89b4c6e0d1 Replaced deprecated ServeFiles 2014-07-24 16:52:16 +03:00
Sasha Myasoedov 8933874582 Fixed tests up to master branch 2014-07-24 16:28:13 +03:00
msoedov f944cff1a8 Added tests for ServeFiles #37 2014-07-05 18:06:24 +03:00
Alexander Nyquist 70593e8dfe Added test for requests to / when no route for / is defined 2014-07-04 11:01:11 +02:00
Alexander Nyquist a0ae5c296d Started writing unit tests 2014-07-04 10:12:28 +02:00