Can somebody confirm this behavior and provide a solution? Using truffle test I get the error message Member "functionName" not found or not visible after argument-dependent lookup in library A. Is it because I am trying to write a test for a library?


pragma solidity 0.4.21;
library A{
    function functionName(uint256 a, uint256 b) public pure returns(bool){
        return (a == b);


import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/A.sol";

contract TestA {
  function test_functionName() {
    A a = A(DeployedAddresses.A());

    bool expected = false;
    Assert.equal(a.functionName(1, 0), expected, "Comparing: 1 is not 0");


var A = artifacts.require("A");

module.exports = function(deployer) {
  • 1
    What is your migration script? – Ismael May 15 '18 at 20:51
  • @Ismael I updated the info. The contract is migrating fine. – Senju May 16 '18 at 1:56
  • 1
    Problem seems to be fixed since Truffle v4.1.8 (core: 4.1.9). – Senju May 25 '18 at 0:08

You Should try to import as:- import { A } from "../contracts/A.sol"; And use A.functionName(). Because in solidity "library" are special type of contracts that specially use to program a reusable piece of code. You can think of this as static function in any OOP language. May this will help you.

| improve this answer | |
  • Wow! Changing the way of importing a library actually solved the issue. Thanks! – Senju May 16 '18 at 2:33
  • You do not need to change the import line, you only need to change a.functionName() by A.functionName() – Ismael May 16 '18 at 3:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.