Comments (4)
I'd prefer to use const
s. In this case we can change time type from Instant
to SystemTime
and in tests set this time manually to the past like it was done in onion. It's simpler than this magic with lazy static. And one more benefit - SystemTime
is more precise than Instant
:
Note, however, that instants are not guaranteed to be steady. In other words, each tick of the underlying clock may not be the same length (e.g. some seconds may be longer than others). An instant may jump forwards or experience time dilation (slow down or speed up), but it will never go backwards.
from tox.
One thing that came to my mind - we can define different constants for tests and real code, using cfg
attribute:
#[cfg(not(test))]
const MY_CONST: u32 = 1;
#[cfg(test)]
const MY_CONST: u32 = 123;
from tox.
Do we need this issue anymore?
from tox.
It depends. We still have these values as variables in config, and it's better to refactor it and change them to consts.
from tox.
Related Issues (20)
- Race in toxcore::tcp::client::client::tests::spawn HOT 3
- Replace IpPort::is_global with IpAddr::is_global from std
- Replace Digest with a plain array in OnionAnnounceResponsePayload HOT 2
- Get rid of byteorder
- Return with custom ErrorKind at nom 5.0
- Remove custom GetPayloadError in favor of macro error_kind!
- ssh HOT 2
- ssh or vpn HOT 1
- Update cookie_factory from 0.2 to 0.3
- Move to async/await HOT 1
- Replace blocking Mutex with future Mutex HOT 8
- Failure is deprecated HOT 3
- AWTCY (AreWeToxClientYet)? HOT 8
- [Question] Can I send friend request with a message? HOT 2
- Replace PrecomputedCache's blocking Mutex with future Mutex
- Get rid of libsodium
- Api
- Question: tox-rs vs. c-toxcore - differences when deployed as server node HOT 4
- How to send file? HOT 1
- Build fails when used as a cargo git dependency HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tox.