From 2d5f29f7f3ccae6ab26c8ed114a9ecdcfda5ab46 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 21 May 2019 23:59:22 +0300 Subject: [PATCH] trim evm versions in the list --- .../lib/explorer/smart_contract/solidity/code_compiler.ex | 1 + .../explorer/smart_contract/solidity/code_compiler_test.exs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex b/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex index b7d9de11f7..3e41bb08fa 100644 --- a/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex +++ b/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex @@ -128,6 +128,7 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do :explorer |> Application.get_env(:allowed_evm_versions) |> String.split(",") + |> Enum.map(fn version -> String.trim(version) end) end def get_contract_info(contracts, _) when contracts == %{}, do: {:error, :compilation} diff --git a/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs b/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs index 87cee2e7ff..9a171a9ed0 100644 --- a/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs +++ b/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs @@ -278,13 +278,14 @@ defmodule Explorer.SmartContract.Solidity.CodeCompilerTest do Application.put_env(:explorer, :allowed_evm_versions, @allowed_evm_versions_pattern) response = CodeCompiler.allowed_evm_versions() - assert response = ["CustomEVM1", "CustomEVM2", "CustomEVM3"] + assert ["CustomEVM1", "CustomEVM2", "CustomEVM3"] = response end test "returns default_allowed_evm_versions" do Application.put_env(:explorer, :allowed_evm_versions, @allowed_evm_versions_default) response = CodeCompiler.allowed_evm_versions() - assert response = ["homestead", "tangerineWhistle", "spuriousDragon", "byzantium", "constantinople", "petersburg"] + + assert ["homestead", "tangerineWhistle", "spuriousDragon", "byzantium", "constantinople", "petersburg"] = response end end