1. 13 8月, 2017 4 次提交
    • B
      env vars should be referenced, not copied · 6740faa7
      Benjamin Sago 提交于
      Just because the type that gets used right now is Copy and Clone doesn’t mean that when we pass mock ones in for tests they’ll be those two as well. So we have to go through and add &s everywhere.
      6740faa7
    • B
      match-to-if-let · 33e83acc
      Benjamin Sago 提交于
      33e83acc
    • B
      Thread the row threshold through grid_details · da00e2fd
      Benjamin Sago 提交于
      No new features here, just some restructuring. Mode::GridDetails was nice and elegant with those two fields, but now there’s a grid-details-only option the elegance has gone out the window.
      da00e2fd
    • B
      By lines, I meant details · a6ed4210
      Benjamin Sago 提交于
      Yeah, I forgot what I was meant to be doing half-way through.
      
      This also adds the row_threshold field, which disables the view unless there will be more than the given number of rows. Getting the row count required upgrading term_grid to a version that has that function added.
      a6ed4210
  2. 12 8月, 2017 8 次提交
  3. 11 8月, 2017 5 次提交
    • B
      Hide xattr errors unless --extended · 5189d66e
      Benjamin Sago 提交于
      exa now ignores errors when checking for extended attributes when the user didn’t explicitly demand that they be checked. If a file does have xattrs, it’ll still display the @ in the permissions column; errors will now just cause the @ to be hidden instead.
      
      This changed a lot of the xtests, which were displaying the error message in a few situations. Those tests have gained @-suffixed companions so the actual error messages can still be tested.
      
      Fixes #178 (finally)
      5189d66e
    • B
      Merge branch 'strict-mode-properly' · 97d14723
      Benjamin Sago 提交于
      This adds a check for the EXA_STRICT environment variable, and uses it to put exa in a strict mode, which enables more checks for useless/redundant arguments.
      
      Its other goal was to move all the option parsing tests out of options/mod.rs and into the files where they’re actually relevant. THIS IS NOT YET DONE and I’ll have to do some more work on this prior to release to clear up the last few lingering issues. There are almost certainly going to be cases where redundant arguments are still complained about (or ignored) by mistake.
      
      But I want to get this branch merged so I can take care of some other stuff for the next release.
      97d14723
    • B
      Add actual error messages for the error messages · b2866766
      Benjamin Sago 提交于
      The annoying part is trying to format!() an OsStr.
      b2866766
    • B
      Integrate strict mode, use it to test file sizes · adaa36e1
      Benjamin Sago 提交于
      It’s a good test to be able to switch strict mode on in run.sh and not have it break anything! Now, the EXA_STRICT environment variable will toggle it on. We can even switch it off and see that it doesn’t error.
      adaa36e1
    • B
      Extract var_os and use the mock to test · dbebd60c
      Benjamin Sago 提交于
      Some of the deduce functions used to just blatantly call std::env::var_os and not care, introducing global state into a module that was otherwise nice and functional and self-contained. (Well, almost. There’s still terminal width.)
      
      Anyway, this made it hard to test, because we couldn’t test it fully with this global dependency in place. It *is* possible to work around this by actually setting the environment variables in the tests, but this way is more self-documenting.
      
      With this in place, we can start to unit test things like deriving the view by passing in what the $COLUMNS environment variable should be, and that’s one of the first things checked.
      
      src/options/mod.rs *almost* has all its tests moved to where they should be!
      dbebd60c
  4. 10 8月, 2017 6 次提交
    • B
      Only complain about long options in strict mode · 532ebbc5
      Benjamin Sago 提交于
      Fixes #152. It just puts the check behind a flag and moves the tests around.
      532ebbc5
    • B
      New macro for testing deduce errors · f389943b
      Benjamin Sago 提交于
      Sometimes, the type in the Ok part of the Result wouldn’t implement PartialEq, so the first macro (which uses assert_eq) won’t work. In these cases, this new macro can be used instead, which just unwraps the Err’s contents. In other cases, it can shave off a ) at the end of a few lines.
      f389943b
    • B
      Extract table columns into a struct · 6755ee6a
      Benjamin Sago 提交于
      The table Options struct is roughly half runtime configuration and half flags to select which columns to display The column fields might as well be in their own struct, and now that the ‘for_dir’ function doesn’t use SizeFormat, it can be moved to Columns.
      6755ee6a
    • B
      Move size format out of Column · e98c7650
      Benjamin Sago 提交于
      Way in the past, the size format was the only variable column; the others were all fixed. Now there are many configurable columns and this field was still hanging around. The code that does the rendering just gets the size format as an argument, and now it works the same way as the TimeFormat.
      e98c7650
    • B
      Make SizeFormat lenient, and add tests · 6b309d5c
      Benjamin Sago 提交于
      This changes the SizeFormat option parser from its old, strict-by-default behaviour (where passing both --bytes and --binary would be an error) to the new, use-the-last-argument behaviour (where passing --bytes --binary would use --binary because it came later).
      
      Doing this meant adding functionality to Matches so that it could return *which* argument matched. Previously, the order of --bytes and --binary didn’t matter, because they couldn’t both be present, but now it does.
      6b309d5c
    • B
      Document and test time formats · b2947ed5
      Benjamin Sago 提交于
      b2947ed5
  5. 09 8月, 2017 2 次提交
    • B
      Decouple assert_eq! and assert_parses · 0b87392f
      Benjamin Sago 提交于
      The assert_parses function was problematic because it insisted on using assert_eq! to check its contents. This won’t work for any type we want to test that doesn’t implement PartialEq, such as TimeFormat, which holds references to years and date strings and other such.
      
      To go about fixing this, the first step is to change that function so it only does the initial processing, rather than the assertion, which is now done outside of it in the test macros instead.
      0b87392f
    • B
      Be stricter in strict mode · ff497b52
      Benjamin Sago 提交于
      Now the code actually starts to use the Strictness flag that was added in the earlier commit! Well, the *code* doesn’t, but the tests do: the macros that create the test cases now have a parameter for which tests they should run. It’s usually ‘Both’ for both strict mode and default mode, but can be specified to only run in one, for when the results differ (usually when options override one another)
      
      The downside to strict mode is that, now, *any* call to `matches.has` or `matches.get` could fail, because an option could have been specified twice, and this is the place where those are checked for. This makes the code a little less ergonomic in places, but that’s what the ? operator is for. The only place this has really had an effect is in `Classify::deduce`, which used to just return a boolean but can now fail.
      
      In order to more thoroughly test the mode, some of the older parts of the code can now act more strict. For example, `TerminalColours::deduce` will now use the last-given option rather than searching for “colours” before “colors”.
      
      Help and Version continue doing their own thing.
      ff497b52
  6. 08 8月, 2017 2 次提交
    • B
      Make these tests less long · d97f603e
      Benjamin Sago 提交于
      d97f603e
    • B
      Thread Strictness through the parser · 00379cce
      Benjamin Sago 提交于
      The value is ignored, but this broke quite a lot of tests that assumed MatchedFlags had only one field.
      
      Parsing tests have to have OsStr flags because I couldn’t get that part working right, but in general, some tests now re-use common functionality too.
      00379cce
  7. 07 8月, 2017 8 次提交
  8. 06 8月, 2017 5 次提交
    • B
      Allow xattrs to be shown in --tree without --long · 89540edb
      Benjamin Sago 提交于
      This restriction was originally only there because a standalone --tree wasn’t a thing. Now it’s there, there’s no reason to forbid the combination.
      89540edb
    • N
      Add raw file type for Olympus and Nikon · e43e288d
      Nontawat Numor 提交于
      e43e288d
    • A
      fix issue #213 iso date format inversion · fca5b6b9
      Alfred Sawaya 提交于
      fca5b6b9
    • A
      Fix month name widths once and for all #244 · cb2e94a7
      Alfred Sawaya 提交于
      To render the date, Exa now find out the month with the longest name
      among all months, and use the width of that.
      cb2e94a7
    • B
      Merge remote-tracking branch origin/option-pars-ng · b5bcf226
      Benjamin Sago 提交于
      This merges in exa’s own new options parser, which has the following features:
      
      - You can specify an option twice and it’ll use the second one, making aliases usable for defaults (fixes #144)
      - Lets arguments be specified more than once (fixes #125)
      
      Strict mode is not done yet; I just wanted to merge this in because it’s been a while, and there’s work that needs to be done on master so I don’t want them drifting apart any further.
      
      It’s likely that you’ll find cases where multiple arguments doesn’t work or where the wrong value is being used. There aren’t tests for *everything* yet, and it still uses global environment variables.
      
      # Conflicts:
      #	src/options/view.rs
      b5bcf226