##// END OF EJS Templates
tests: add test for Rust formatting...
Gregory Szorc -
r44271:e8a3bbff default
parent child Browse files
Show More
@@ -0,0 +1,9 b''
1 #require rustfmt test-repo
2
3 $ . "$TESTDIR/helpers-testrepo.sh"
4
5 $ cd "$TESTDIR"/..
6 $ RUSTFMT=$(rustup which --toolchain nightly rustfmt)
7 $ for f in `testrepohg files 'glob:**/*.rs'` ; do
8 > $RUSTFMT --check --unstable-features --color=never $f
9 > done
@@ -1015,3 +1015,11 b' def has_pytype():'
1015 version = matchoutput(pytypecmd, b'[0-9a-b.]+')
1015 version = matchoutput(pytypecmd, b'[0-9a-b.]+')
1016 sv = distutils.version.StrictVersion
1016 sv = distutils.version.StrictVersion
1017 return version and sv(_strpath(version.group(0))) >= sv('2019.10.17')
1017 return version and sv(_strpath(version.group(0))) >= sv('2019.10.17')
1018
1019
1020 @check("rustfmt", "rustfmt tool")
1021 def has_rustfmt():
1022 # We use Nightly's rustfmt due to current unstable config options.
1023 return matchoutput(
1024 '`rustup which --toolchain nightly rustfmt` --version', b'rustfmt'
1025 )
@@ -1363,6 +1363,20 b' class Test(unittest.TestCase):'
1363 if PYTHON3 and os.name == 'nt':
1363 if PYTHON3 and os.name == 'nt':
1364 env['PYTHONLEGACYWINDOWSSTDIO'] = '1'
1364 env['PYTHONLEGACYWINDOWSSTDIO'] = '1'
1365
1365
1366 # Modified HOME in test environment can confuse Rust tools. So set
1367 # CARGO_HOME and RUSTUP_HOME automatically if a Rust toolchain is
1368 # present and these variables aren't already defined.
1369 cargo_home_path = os.path.expanduser('~/.cargo')
1370 rustup_home_path = os.path.expanduser('~/.rustup')
1371
1372 if os.path.exists(cargo_home_path) and b'CARGO_HOME' not in osenvironb:
1373 env['CARGO_HOME'] = cargo_home_path
1374 if (
1375 os.path.exists(rustup_home_path)
1376 and b'RUSTUP_HOME' not in osenvironb
1377 ):
1378 env['RUSTUP_HOME'] = rustup_home_path
1379
1366 # Reset some environment variables to well-known values so that
1380 # Reset some environment variables to well-known values so that
1367 # the tests produce repeatable output.
1381 # the tests produce repeatable output.
1368 env['LANG'] = env['LC_ALL'] = env['LANGUAGE'] = 'C'
1382 env['LANG'] = env['LC_ALL'] = env['LANGUAGE'] = 'C'
General Comments 0
You need to be logged in to leave comments. Login now