Skip to content

Commit

Permalink
[lint] Remove no-unused-vars warnings from Tests (#1260)
Browse files Browse the repository at this point in the history
This commit removes 'no-unused-vars' warnings from Tests.

ONE-vscode-DCO-1.0-Signed-off-by: Dayoung Lee <[email protected]>

Co-authored-by: Dayoung Lee <[email protected]>
  • Loading branch information
dayo09 and dayo09 authored Sep 13, 2022
1 parent 875c5ad commit 5b46d8a
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/Tests/Backend/Compiler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ suite('Backend', function() {
suite('CompilerBase', function() {
suite('#constructor()', function() {
test('Create dummy compiler', function(pass) {
const compiler = new CompilerBase();
assert.doesNotThrow(() => new CompilerBase());

pass();
assert.ok(true);
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Backend/Executor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ suite('Backend', function() {
suite('ExecutorBase', function() {
suite('#constructor()', function() {
test('Create dummy executor', function(pass) {
const executor = new ExecutorBase();
assert.doesNotThrow(() => new ExecutorBase());

pass();
assert.ok(true);
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Backend/Toolchain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ suite('Backend', function() {

suite('#constructor()', function() {
test('Create dummy toolchain', function(pass) {
const toolchain = new Toolchain(toolchainInfo);
assert.doesNotThrow(() => new Toolchain(toolchainInfo));

pass();
assert.ok(true);
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Backend/ToolchainImpl/DebianToolchain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import {assert} from 'chai';
import {PackageInfo, ToolchainInfo} from '../../../Backend/Toolchain';
import {ToolchainInfo} from '../../../Backend/Toolchain';
import {DebianArch, DebianRepo, DebianToolchain} from '../../../Backend/ToolchainImpl/DebianToolchain';
import {Version} from '../../../Backend/Version';

Expand Down
6 changes: 3 additions & 3 deletions src/Tests/Execute/Device.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ suite('Device', function() {
const sw: string = 'TestOS';
const testSpec = new DeviceSpec(hw, sw, undefined);
try {
const testDevice = new Device(deviceName, testSpec);
new Device(deviceName, testSpec);
} catch (err: any) {
assert.strictEqual(err.message, 'empty name device cannot be created.');
}
Expand All @@ -61,7 +61,7 @@ suite('Device', function() {
const sw: string = 'Tizen 7.0.0';
const testSpec = new TizenDeviceSpec(hw, sw);
try {
const tizenTV = new Device(deviceName, testSpec);
new Device(deviceName, testSpec);
} catch (err: any) {
assert.strictEqual(err.message, 'empty name device cannot be created.');
}
Expand All @@ -85,7 +85,7 @@ suite('Device', function() {
const sw: string = 'TestOS';
const testSpec = new HostPCSpec(hw, sw);
try {
const hostPC = new Device(deviceName, testSpec);
new Device(deviceName, testSpec);
} catch (err: any) {
assert.strictEqual(err.message, 'empty name device cannot be created.');
}
Expand Down
8 changes: 3 additions & 5 deletions src/Tests/Execute/DeviceViewProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import {assert} from 'chai';
import * as vscode from 'vscode';
import {globalExecutorArray} from '../../Backend/API';
import {ExecutorBase} from '../../Backend/Executor';
import {deviceManagerList, DeviceViewNode, DeviceViewProvider, NodeType} from '../../Execute/DeviceViewProvider';


Expand Down Expand Up @@ -101,7 +99,7 @@ suite('DeviceViewProvider', function() {
suite('#getChildren', function() {
test('get Children under undfined', function(done) {
let provider = new DeviceViewProvider();
provider.loadDeviceManager('local', function(_provider: DeviceViewProvider) {
provider.loadDeviceManager('local', function() {
let deviceManagers = provider.getChildren();
assert.strictEqual(deviceManagers.length, deviceManagerList.length);
for (let index = 0; index < deviceManagers.length; index++) {
Expand All @@ -112,7 +110,7 @@ suite('DeviceViewProvider', function() {
});
test('get Children under deviceManager Node', function(done) {
let provider = new DeviceViewProvider();
provider.loadDeviceManager('local', function(_provider: DeviceViewProvider) {
provider.loadDeviceManager('local', function() {
for (const key in provider.deviceManagerMap) {
if (Object.prototype.hasOwnProperty.call(provider.deviceManagerMap, key)) {
const element = provider.deviceManagerMap[key];
Expand All @@ -130,7 +128,7 @@ suite('DeviceViewProvider', function() {
});
test('get Children under Device Node', function(done) {
let provider = new DeviceViewProvider();
provider.loadDeviceManager('local', function(_provider: DeviceViewProvider) {
provider.loadDeviceManager('local', function() {
for (const key in provider.deviceManagerMap) {
if (Object.prototype.hasOwnProperty.call(provider.deviceManagerMap, key)) {
const element = provider.deviceManagerMap[key];
Expand Down
7 changes: 2 additions & 5 deletions src/Tests/Job/ToolRunner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

import {assert} from 'chai';
import {join} from 'path';

import {ToolArgs} from '../../Job/ToolArgs';
import {SuccessResult, ToolRunner} from '../../Job/ToolRunner';
Expand Down Expand Up @@ -116,8 +115,6 @@ suite('Job', function() {

suite(`#kill()`, function() {
test('basic case', async function() {
let finished = false;

let toolRunner = new ToolRunner();

let args = new ToolArgs();
Expand All @@ -128,7 +125,7 @@ suite('Job', function() {
.then((val: SuccessResult) => {
assert.equal(val.intentionallyKilled, true);
})
.catch(exitcode => {
.catch(() => {
assert.fail();
});

Expand All @@ -155,7 +152,7 @@ suite('Job', function() {
assert.equal(val.exitCode, 0);
finished = true;
})
.catch(exitcode => {
.catch(() => {
assert.fail();
});

Expand Down
2 changes: 1 addition & 1 deletion src/Tests/OneExplorer/ArtifactLocator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ suite('OneExplorer', function() {
// Register a locator which always throws
locatorRunner.register({
artifactAttr: {ext: '.test'},
locator: new Locator(value => {
locator: new Locator(() => {
throw Error('Test');
})
});
Expand Down
4 changes: 0 additions & 4 deletions src/Tests/OneExplorer/ConfigObject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,6 @@ command=--save-chrome-trace ${traceName}

// Get file paths inside the temp directory
const configPath = testBuilder.getPath(configName);
const tracePath = testBuilder.getPath(traceName);

const configObj = ConfigObj.createConfigObj(vscode.Uri.file(configPath));

// Validation
Expand Down Expand Up @@ -810,8 +808,6 @@ commands=--save-chrome-trace ${traceName}

// Get file paths inside the temp directory
const configPath = testBuilder.getPath(configName);
const tracePath = testBuilder.getPath(traceName);

const configObj = ConfigObj.createConfigObj(vscode.Uri.file(configPath));

// Validation
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/OneExplorer/OneExplorer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import * as fs from 'fs';
import * as path from 'path';
import * as vscode from 'vscode';

import {_unit_test_BaseModelNode as BaseModelNode, _unit_test_ConfigNode as ConfigNode, _unit_test_DirectoryNode as DirectoryNode, _unit_test_getCfgList as getCfgList, _unit_test_NodeFactory as NodeFactory, _unit_test_NodeType as NodeType, _unit_test_OneNode as OneNode, _unit_test_ProductNode as ProductNode} from '../../OneExplorer/OneExplorer';
import {_unit_test_BaseModelNode as BaseModelNode, _unit_test_ConfigNode as ConfigNode, _unit_test_getCfgList as getCfgList, _unit_test_NodeFactory as NodeFactory, _unit_test_NodeType as NodeType, _unit_test_OneNode as OneNode, _unit_test_ProductNode as ProductNode} from '../../OneExplorer/OneExplorer';
import {obtainWorkspaceRoot} from '../../Utils/Helpers';


Expand Down
1 change: 0 additions & 1 deletion src/Tests/OneExplorer/OneStorage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ input_path=${modelName}

testBuilder.writeFileSync(modelName, '', 'workspace');

const modelPath = testBuilder.getPath(modelName, 'workspace');
{ assert.isUndefined(OneStorage.getCfgs('invalid/path')); }
});

Expand Down
12 changes: 6 additions & 6 deletions src/Tests/Toolchain/ToolchainEnv.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ suite('Toolchain', function() {
(value) => {
assert.equal(value, true);
},
(_reason) => {
() => {
assert.fail();
});
});
Expand All @@ -136,7 +136,7 @@ suite('Toolchain', function() {
let env = new ToolchainEnv(compiler);
const job0 = new MockFailedJob('job0');
const jobs: Array<Job> = [job0];
env.request(jobs).then((_value) => {
env.request(jobs).then(() => {
assert.fail();
});
});
Expand All @@ -148,10 +148,10 @@ suite('Toolchain', function() {
const job1 = new MockFailedJob('job1');
const jobs: Array<Job> = [job0, job1];
env.request(jobs).then(
(_value) => {
() => {
assert.fail();
},
(_reason) => {
() => {
assert.isTrue(true);
});
});
Expand All @@ -160,10 +160,10 @@ suite('Toolchain', function() {
test('requests prerequisites', function() {
let env = new ToolchainEnv(compiler);
env.prerequisites().then(
(_value) => {
() => {
assert.isTrue(true);
},
(_reason) => {
() => {
assert.fail();
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/Utils/PipedSpawn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ suite('Utils', function() {

test('NEG: first cmd fails', function() {
try {
let cat = pipedSpawn('cat', ['invalid_file'], {}, 'wc', ['-l'], {});
pipedSpawn('cat', ['invalid_file'], {}, 'wc', ['-l'], {});
} catch (err) {
assert.ok(true, 'Should be thrown');
}
Expand All @@ -64,7 +64,7 @@ suite('Utils', function() {
sudo.stdout!.on('data', (data) => {
assert.fail(`should not fail. ${data}`);
});
sudo.on('exit', (exitcode: number|null, signal: NodeJS.Signals|null) => {
sudo.on('exit', (exitcode: number|null) => {
if (exitcode === 0) {
assert.fail(`exitcode === 0`);
} else {
Expand Down

0 comments on commit 5b46d8a

Please sign in to comment.