From c34ce4b4b58287199da51dfafcb88e0078009300 Mon Sep 17 00:00:00 2001 From: lianahus Date: Tue, 13 Apr 2021 11:49:03 +0200 Subject: [PATCH 1/9] createing default workspace --- apps/remix-ide/src/app/files/fileManager.js | 1 - .../src/app/files/workspaceFileProvider.js | 13 ++++++++--- .../workspace/src/lib/remix-ui-workspace.tsx | 22 ++++++++++++++++++- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/apps/remix-ide/src/app/files/fileManager.js b/apps/remix-ide/src/app/files/fileManager.js index 932368c20b..40e7aa2fff 100644 --- a/apps/remix-ide/src/app/files/fileManager.js +++ b/apps/remix-ide/src/app/files/fileManager.js @@ -564,7 +564,6 @@ class FileManager extends Plugin { return this._deps.filesProviders.browser } const provider = this._deps.filesProviders.workspace - if (!provider.isReady()) throw createError({ code: 'ECONNRESET', message: 'No workspace has been opened.' }) return this._deps.filesProviders.workspace } diff --git a/apps/remix-ide/src/app/files/workspaceFileProvider.js b/apps/remix-ide/src/app/files/workspaceFileProvider.js index 70854929d9..3a779f77bc 100644 --- a/apps/remix-ide/src/app/files/workspaceFileProvider.js +++ b/apps/remix-ide/src/app/files/workspaceFileProvider.js @@ -1,5 +1,6 @@ 'use strict' +const EventManager = require('../../lib/events') const FileProvider = require('./fileProvider') const pathModule = require('path') @@ -8,6 +9,7 @@ class WorkspaceFileProvider extends FileProvider { super('') this.workspacesPath = '.workspaces' this.workspace = null + this.event = new EventManager() } setWorkspace (workspace) { @@ -28,7 +30,7 @@ class WorkspaceFileProvider extends FileProvider { } removePrefix (path) { - if (!this.workspace) throw new Error('No workspace has been opened.') + if (!this.workspace) this.createDefaultWorkspace() path = path.replace(/^\/|\/$/g, '') // remove first and last slash if (path.startsWith(this.workspacesPath + '/' + this.workspace)) return path if (path.startsWith(this.workspace)) return this.workspacesPath + '/' + this.workspace @@ -49,7 +51,7 @@ class WorkspaceFileProvider extends FileProvider { } resolveDirectory (path, callback) { - if (!this.workspace) throw new Error('No workspace has been opened.') + if (!this.workspace) this.createDefaultWorkspace() super.resolveDirectory(path, (error, files) => { if (error) return callback(error) const unscoped = {} @@ -74,9 +76,14 @@ class WorkspaceFileProvider extends FileProvider { } _normalizePath (path) { - if (!this.workspace) throw new Error('No workspace has been opened.') + if (!this.workspace) this.createDefaultWorkspace() return path.replace(this.workspacesPath + '/' + this.workspace + '/', '') } + + createDefaultWorkspace() { + this.workspace = 'workspace_default' + this.event.trigger('create_workspace_default', [this.workspace]) + } } module.exports = WorkspaceFileProvider diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 6a41a942bc..c53d2336e2 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -2,6 +2,7 @@ import React, { useState, useEffect, useRef } from 'react' // eslint-disable-lin import { FileExplorer } from '@remix-ui/file-explorer' // eslint-disable-line import './remix-ui-workspace.css' import { ModalDialog } from '@remix-ui/modal-dialog' // eslint-disable-line +import { Toaster } from '@remix-ui/toaster' /* eslint-disable-next-line */ export interface WorkspaceProps { @@ -101,6 +102,17 @@ export const Workspace = (props: WorkspaceProps) => { remixdExplorer.loading() }) + props.workspace.event.register('create_workspace_default', async (workspaceName) => { + try { + await props.createWorkspace(workspaceName) + await setWorkspace(workspaceName) + toast("New default workspace has been created.") + } catch (e) { + modalMessage('Create Default Workspace', e.message) + console.error(e) + } + }) + if (props.initialWorkspace) { props.workspace.setWorkspace(props.initialWorkspace) setState(prevState => { @@ -131,9 +143,16 @@ export const Workspace = (props: WorkspaceProps) => { }, handleHide: null }, - loadingLocalhost: false + loadingLocalhost: false, + toasterMsg: '', }) + const toast = (message: string) => { + setState(prevState => { + return { ...prevState, toasterMsg: message } + }) + } + /* workspace creation, renaming and deletion */ const renameCurrentWorkspace = () => { @@ -312,6 +331,7 @@ export const Workspace = (props: WorkspaceProps) => { handleHide={ handleHideModal }> { (typeof state.modal.message !== 'string') && state.modal.message } +
resetFocus(true)}>
From 98f5d8cc7ae00752bd702b4c7c64f00e4398d861 Mon Sep 17 00:00:00 2001 From: lianahus Date: Tue, 13 Apr 2021 12:49:53 +0200 Subject: [PATCH 2/9] fixed home actions --- apps/remix-ide/src/app/files/fileManager.js | 1 - apps/remix-ide/src/app/files/workspaceFileProvider.js | 4 ++-- apps/remix-ide/src/app/panels/file-panel.js | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/remix-ide/src/app/files/fileManager.js b/apps/remix-ide/src/app/files/fileManager.js index 40e7aa2fff..cc73ba0942 100644 --- a/apps/remix-ide/src/app/files/fileManager.js +++ b/apps/remix-ide/src/app/files/fileManager.js @@ -563,7 +563,6 @@ class FileManager extends Plugin { if (file.startsWith('browser')) { return this._deps.filesProviders.browser } - const provider = this._deps.filesProviders.workspace return this._deps.filesProviders.workspace } diff --git a/apps/remix-ide/src/app/files/workspaceFileProvider.js b/apps/remix-ide/src/app/files/workspaceFileProvider.js index 3a779f77bc..9d3159c283 100644 --- a/apps/remix-ide/src/app/files/workspaceFileProvider.js +++ b/apps/remix-ide/src/app/files/workspaceFileProvider.js @@ -80,8 +80,8 @@ class WorkspaceFileProvider extends FileProvider { return path.replace(this.workspacesPath + '/' + this.workspace + '/', '') } - createDefaultWorkspace() { - this.workspace = 'workspace_default' + createDefaultWorkspace () { + this.workspace = 'generated_workspace' this.event.trigger('create_workspace_default', [this.workspace]) } } diff --git a/apps/remix-ide/src/app/panels/file-panel.js b/apps/remix-ide/src/app/panels/file-panel.js index 7e44fc2520..c76d822c94 100644 --- a/apps/remix-ide/src/app/panels/file-panel.js +++ b/apps/remix-ide/src/app/panels/file-panel.js @@ -175,10 +175,12 @@ module.exports = class Filepanel extends ViewPlugin { } async createNewFile () { + if (!this.workspaceExists()) this.createWorkspace('generated_workspace') return await this.request.createNewFile() } async uploadFile (event) { + if (!this.workspaceExists()) this.createWorkspace('generated_workspace') return await this.request.uploadFile(event) } From a9a96b7e7005a36815fe3aa0fc7b1e62b547b416 Mon Sep 17 00:00:00 2001 From: lianahus Date: Tue, 13 Apr 2021 13:17:08 +0200 Subject: [PATCH 3/9] linter --- apps/remix-ide/src/app/panels/file-panel.js | 4 ++-- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/remix-ide/src/app/panels/file-panel.js b/apps/remix-ide/src/app/panels/file-panel.js index c76d822c94..15434ec6ce 100644 --- a/apps/remix-ide/src/app/panels/file-panel.js +++ b/apps/remix-ide/src/app/panels/file-panel.js @@ -175,12 +175,12 @@ module.exports = class Filepanel extends ViewPlugin { } async createNewFile () { - if (!this.workspaceExists()) this.createWorkspace('generated_workspace') + if (!this.workspaceExists()) this.createWorkspace('default_workspace') return await this.request.createNewFile() } async uploadFile (event) { - if (!this.workspaceExists()) this.createWorkspace('generated_workspace') + if (!this.workspaceExists()) this.createWorkspace('default_workspace') return await this.request.uploadFile(event) } diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index c53d2336e2..ff1ea795c5 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef } from 'react' // eslint-disable-lin import { FileExplorer } from '@remix-ui/file-explorer' // eslint-disable-line import './remix-ui-workspace.css' import { ModalDialog } from '@remix-ui/modal-dialog' // eslint-disable-line -import { Toaster } from '@remix-ui/toaster' +import { Toaster } from '@remix-ui/toaster'// eslint-disable-line /* eslint-disable-next-line */ export interface WorkspaceProps { @@ -106,7 +106,7 @@ export const Workspace = (props: WorkspaceProps) => { try { await props.createWorkspace(workspaceName) await setWorkspace(workspaceName) - toast("New default workspace has been created.") + toast('New default workspace has been created.') } catch (e) { modalMessage('Create Default Workspace', e.message) console.error(e) @@ -144,7 +144,7 @@ export const Workspace = (props: WorkspaceProps) => { handleHide: null }, loadingLocalhost: false, - toasterMsg: '', + toasterMsg: '' }) const toast = (message: string) => { From c2c3f7871f3245b62841eda985f36ee266cc9c7f Mon Sep 17 00:00:00 2001 From: lianahus Date: Tue, 13 Apr 2021 13:25:42 +0200 Subject: [PATCH 4/9] renamed --- .../src/app/files/workspaceFileProvider.js | 12 +++++----- apps/remix-ide/src/app/panels/file-panel.js | 21 ++++++++-------- .../workspace/src/lib/remix-ui-workspace.tsx | 24 ++++++++++++------- 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/apps/remix-ide/src/app/files/workspaceFileProvider.js b/apps/remix-ide/src/app/files/workspaceFileProvider.js index 9d3159c283..d448ae3804 100644 --- a/apps/remix-ide/src/app/files/workspaceFileProvider.js +++ b/apps/remix-ide/src/app/files/workspaceFileProvider.js @@ -30,7 +30,7 @@ class WorkspaceFileProvider extends FileProvider { } removePrefix (path) { - if (!this.workspace) this.createDefaultWorkspace() + if (!this.workspace) this.createWorkspace() path = path.replace(/^\/|\/$/g, '') // remove first and last slash if (path.startsWith(this.workspacesPath + '/' + this.workspace)) return path if (path.startsWith(this.workspace)) return this.workspacesPath + '/' + this.workspace @@ -51,7 +51,7 @@ class WorkspaceFileProvider extends FileProvider { } resolveDirectory (path, callback) { - if (!this.workspace) this.createDefaultWorkspace() + if (!this.workspace) this.createWorkspace() super.resolveDirectory(path, (error, files) => { if (error) return callback(error) const unscoped = {} @@ -76,13 +76,13 @@ class WorkspaceFileProvider extends FileProvider { } _normalizePath (path) { - if (!this.workspace) this.createDefaultWorkspace() + if (!this.workspace) this.createWorkspace() return path.replace(this.workspacesPath + '/' + this.workspace + '/', '') } - createDefaultWorkspace () { - this.workspace = 'generated_workspace' - this.event.trigger('create_workspace_default', [this.workspace]) + createWorkspace (name) { + if (!name) name = 'default_workspace' + this.event.trigger('create_workspace', [name]) } } diff --git a/apps/remix-ide/src/app/panels/file-panel.js b/apps/remix-ide/src/app/panels/file-panel.js index 15434ec6ce..ecf4b0a55b 100644 --- a/apps/remix-ide/src/app/panels/file-panel.js +++ b/apps/remix-ide/src/app/panels/file-panel.js @@ -175,12 +175,10 @@ module.exports = class Filepanel extends ViewPlugin { } async createNewFile () { - if (!this.workspaceExists()) this.createWorkspace('default_workspace') return await this.request.createNewFile() } async uploadFile (event) { - if (!this.workspaceExists()) this.createWorkspace('default_workspace') return await this.request.uploadFile(event) } @@ -204,14 +202,17 @@ module.exports = class Filepanel extends ViewPlugin { if (!workspaceName) throw new Error('name cannot be empty') if (checkSpecialChars(workspaceName) || checkSlash(workspaceName)) throw new Error('special characters are not allowed') if (await this.workspaceExists(workspaceName)) throw new Error('workspace already exists') - const browserProvider = this._deps.fileProviders.browser - const workspacesPath = this._deps.fileProviders.workspace.workspacesPath - await this.processCreateWorkspace(workspaceName) - for (const file in examples) { - try { - await browserProvider.set('browser/' + workspacesPath + '/' + workspaceName + '/' + examples[file].name, examples[file].content) - } catch (error) { - console.error(error) + else { + this._deps.fileProviders.workspace.setWorkspace(workspaceName) + const browserProvider = this._deps.fileProviders.browser + const workspacesPath = this._deps.fileProviders.workspace.workspacesPath + await this.processCreateWorkspace(workspaceName) + for (const file in examples) { + try { + await browserProvider.set('browser/' + workspacesPath + '/' + workspaceName + '/' + examples[file].name, examples[file].content) + } catch (error) { + console.error(error) + } } } } diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index ff1ea795c5..95cb36597d 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -50,10 +50,13 @@ export const Workspace = (props: WorkspaceProps) => { } props.request.createNewFile = () => { + if (!state.workspaces.length) createNewWorkspace('default_workspace') props.plugin.resetNewFile() } props.request.uploadFile = (target) => { + if (!state.workspaces.length) createNewWorkspace('default_workspace') + setState(prevState => { return { ...prevState, uploadFileEvent: target } }) @@ -102,15 +105,8 @@ export const Workspace = (props: WorkspaceProps) => { remixdExplorer.loading() }) - props.workspace.event.register('create_workspace_default', async (workspaceName) => { - try { - await props.createWorkspace(workspaceName) - await setWorkspace(workspaceName) - toast('New default workspace has been created.') - } catch (e) { - modalMessage('Create Default Workspace', e.message) - console.error(e) - } + props.workspace.event.register('create_workspace', (name) => { + createNewWorkspace(name) }) if (props.initialWorkspace) { @@ -121,6 +117,16 @@ export const Workspace = (props: WorkspaceProps) => { } }, []) + const createNewWorkspace = async (workspaceName) => { + try { + await props.createWorkspace(workspaceName) + await setWorkspace(workspaceName) + toast('New default workspace has been created.') + } catch (e) { + modalMessage('Create Default Workspace', e.message) + console.error(e) + } + } const [state, setState] = useState({ workspaces: [], reset: false, From 0c70fdc02c62caca193f17496d0c9a87849e6ca1 Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 14 Apr 2021 11:42:52 +0200 Subject: [PATCH 5/9] fixed cloas all files --- apps/remix-ide-e2e/src/tests/workspace.test.ts | 2 +- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/workspace.test.ts b/apps/remix-ide-e2e/src/tests/workspace.test.ts index 15b435c890..3235b8594e 100644 --- a/apps/remix-ide-e2e/src/tests/workspace.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace.test.ts @@ -47,7 +47,7 @@ module.exports = { .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_name_1' }) .click('*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok') .waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]') - .waitForElementNotPresent('*[data-id="treeViewLitreeViewItemtest.sol"]') + .waitForElementNotPresent('*[data-id="treeViewLitreeViewItemtest.sol"]', 60000) .click('*[data-id="workspacesSelect"] option[value="workspace_name"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]') }, diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 95cb36597d..00c7254b38 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -119,6 +119,7 @@ export const Workspace = (props: WorkspaceProps) => { const createNewWorkspace = async (workspaceName) => { try { + await props.fileManager.closeAllFiles() await props.createWorkspace(workspaceName) await setWorkspace(workspaceName) toast('New default workspace has been created.') @@ -127,6 +128,7 @@ export const Workspace = (props: WorkspaceProps) => { console.error(e) } } + const [state, setState] = useState({ workspaces: [], reset: false, @@ -224,6 +226,7 @@ export const Workspace = (props: WorkspaceProps) => { const workspaceName = workspaceCreateInput.current.value try { + await props.fileManager.closeAllFiles() await props.createWorkspace(workspaceName) await setWorkspace(workspaceName) } catch (e) { From 5ad4f0e25cc82c5ab566a114ac883a4d9793e0da Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 14 Apr 2021 11:43:38 +0200 Subject: [PATCH 6/9] removed pause --- apps/remix-ide-e2e/src/tests/workspace.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/workspace.test.ts b/apps/remix-ide-e2e/src/tests/workspace.test.ts index 3235b8594e..15b435c890 100644 --- a/apps/remix-ide-e2e/src/tests/workspace.test.ts +++ b/apps/remix-ide-e2e/src/tests/workspace.test.ts @@ -47,7 +47,7 @@ module.exports = { .execute(function () { document.querySelector('*[data-id="modalDialogCustomPromptTextCreate"]')['value'] = 'workspace_name_1' }) .click('*[data-id="workspacesModalDialogModalDialogModalFooter-react"] .modal-ok') .waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]') - .waitForElementNotPresent('*[data-id="treeViewLitreeViewItemtest.sol"]', 60000) + .waitForElementNotPresent('*[data-id="treeViewLitreeViewItemtest.sol"]') .click('*[data-id="workspacesSelect"] option[value="workspace_name"]') .waitForElementVisible('*[data-id="treeViewLitreeViewItemtests"]') }, From 35be771eece4b36cdcaa9d2c55de8d338e1cc2ec Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 14 Apr 2021 15:48:18 +0200 Subject: [PATCH 7/9] renamed the event --- apps/remix-ide/src/app/files/workspaceFileProvider.js | 2 +- libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/files/workspaceFileProvider.js b/apps/remix-ide/src/app/files/workspaceFileProvider.js index d448ae3804..742d85a775 100644 --- a/apps/remix-ide/src/app/files/workspaceFileProvider.js +++ b/apps/remix-ide/src/app/files/workspaceFileProvider.js @@ -82,7 +82,7 @@ class WorkspaceFileProvider extends FileProvider { createWorkspace (name) { if (!name) name = 'default_workspace' - this.event.trigger('create_workspace', [name]) + this.event.trigger('createWorkspace', [name]) } } diff --git a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx index 00c7254b38..3537de5331 100644 --- a/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx +++ b/libs/remix-ui/workspace/src/lib/remix-ui-workspace.tsx @@ -105,7 +105,7 @@ export const Workspace = (props: WorkspaceProps) => { remixdExplorer.loading() }) - props.workspace.event.register('create_workspace', (name) => { + props.workspace.event.register('createWorkspace', (name) => { createNewWorkspace(name) }) From 9c598295d5941536d3a77ddbc6b38b8ec9f0d244 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Thu, 15 Apr 2021 10:10:35 +0100 Subject: [PATCH 8/9] Bump remixd version --- libs/remixd/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remixd/package.json b/libs/remixd/package.json index e2ce01b2c1..607b0a7ff2 100644 --- a/libs/remixd/package.json +++ b/libs/remixd/package.json @@ -1,6 +1,6 @@ { "name": "@remix-project/remixd", - "version": "0.3.4", + "version": "0.3.5", "description": "remix server: allow accessing file system from remix.ethereum.org and start a dev environment (see help section)", "main": "index.js", "types": "./index.d.ts", From b52433aa7e123691481c9390dc504554a671f5c1 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 13 Apr 2021 12:03:56 +0530 Subject: [PATCH 9/9] generated test file updated --- .../remix-ide/src/app/tabs/testTab/testTab.js | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/testTab/testTab.js b/apps/remix-ide/src/app/tabs/testTab/testTab.js index 56ecf1cca1..9b18732950 100644 --- a/apps/remix-ide/src/app/tabs/testTab/testTab.js +++ b/apps/remix-ide/src/app/tabs/testTab/testTab.js @@ -67,11 +67,17 @@ class TestTabLogic { generateTestContractSample (hasCurrent, fileToImport, contractName = 'testSuite') { let relative = remixPath.relative(this.currentPath, remixPath.dirname(fileToImport)) if (relative === '') relative = '.' - const comment = hasCurrent ? `import "${relative}/${remixPath.basename(fileToImport)}";` : '// Import here the file to test.' + const comment = hasCurrent ? `import "${relative}/${remixPath.basename(fileToImport)}";` : '// ' return `// SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.4.22 <0.9.0; -import "remix_tests.sol"; // this import is automatically injected by Remix. + +// This import is automatically injected by Remix +import "remix_tests.sol"; + +// This import is required to use custom transaction context +// Although it may fail compilation in 'Solidity Compiler' plugin +// But it will work fine in 'Solidity Unit Testing' plugin import "remix_accounts.sol"; ${comment} @@ -81,15 +87,15 @@ contract ${contractName} { /// 'beforeAll' runs before all other tests /// More special functions are: 'beforeEach', 'beforeAll', 'afterEach' & 'afterAll' function beforeAll() public { - // Here should instantiate tested contract + // Assert.equal(uint(1), uint(1), "1 should be equal to 1"); } function checkSuccess() public { - // Use 'Assert' to test the contract, - // See documentation: https://remix-ide.readthedocs.io/en/latest/assert_library.html - Assert.equal(uint(2), uint(2), "2 should be equal to 2"); - Assert.notEqual(uint(2), uint(3), "2 should not be equal to 3"); + // Use 'Assert' methods: https://remix-ide.readthedocs.io/en/latest/assert_library.html + Assert.ok(2 == 2, 'should be true'); + Assert.greaterThan(uint(2), uint(1), "2 should be greater than to 1"); + Assert.lesserThan(uint(2), uint(3), "2 should be lesser than to 3"); } function checkSuccess2() public pure returns (bool) { @@ -98,11 +104,10 @@ contract ${contractName} { } function checkFailure() public { - Assert.equal(uint(1), uint(2), "1 is not equal to 2"); + Assert.notEqual(uint(1), uint(1), "1 should not be equal to 1"); } - /// Custom Transaction Context - /// See more: https://remix-ide.readthedocs.io/en/latest/unittesting.html#customization + /// Custom Transaction Context: https://remix-ide.readthedocs.io/en/latest/unittesting.html#customization /// #sender: account-1 /// #value: 100 function checkSenderAndValue() public payable {