lib/file: fix IFStream::close

Signed-off-by: Jean Privat <jean@pryen.org>
tests: improve and fix test_for_abuse.nit

Signed-off-by: Jean Privat <jean@pryen.org>
typing: add method try_get_method

Signed-off-by: Jean Privat <jean@pryen.org>
typing: add AForExpr::method_finish

Signed-off-by: Jean Privat <jean@pryen.org>
interpreter: implements method_finish

Signed-off-by: Jean Privat <jean@pryen.org>
compiler: implements method_finish (partially)

Signed-off-by: Jean Privat <jean@pryen.org>
lib/standard: introduce *Iterator::finish

Signed-off-by: Jean Privat <jean@pryen.org>
tests: add base_for_finish

Signed-off-by: Jean Privat <jean@pryen.org>
tests: detect and use portable time and date command

Advanced behavior of `time` and `date` is not protable. Thus try
to detect known working configurations and use them.

time and date are not fundamental for tests, so having
an unsupported implementation is not a big deal.

Signed-off-by: Jean Privat <jean@pryen.org>
Merge: Fix test of for abuse

Some cleaning of the for_abuse test.

A future PR will improve things.

Pull-Request: #812
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Merge: introduce `Iterator::finish`

While initially playing with for_abuse, an idea was to have the lib informed of an "end of iteration".

When the end of iteration was a result of `is_ok` false, it is easy for the lib to be informed.
But, if for some reason the client chose to abort the loop (with a `break` statement), the lib cannot be informed and some early release of resources cannot occurs.

This PR introduce a new optional service in iterators, namely `finish` that is automatically called at the end of `for` structures.

Currently, there is no user of such a function, but it is a POC that can be used for a nit-version of a `with` structure to implements for_abuse-like controls.

~~~nit
# Simple implementation of the `head` command
var head_limit = 10
for line in read_lines("some file") do
  # `read_lines` opens and reads each line
  head_limit -= 1
  if head_limit < 0 then break
  print line
end
# Here the file is automatically closed thanks to finish
~~~

Pull-Request: #813
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Merge: tests: detect and use portable time and date command

Advanced behavior of `time` and `date` is not protable. Thus try
to detect known working configurations and use them.

time and date are not fundamental for tests, so having
an unsupported implementation is not a big deal.

Pull-Request: #814
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>