const assert = require('assert')
const linter = require('./../../../lib/index')
const { funcWith, contractWith } = require('./../../common/contract-builder')

describe('Linter - mark-callable-contracts', () => {
  it('should return error that external contract is not marked as trusted / untrusted', () => {
    const code = funcWith('Bank.withdraw(100);')

    const report = linter.processStr(code, {
      rules: { 'mark-callable-contracts': 'warn' }
    })

    assert.equal(report.warningCount, 1)
    assert.ok(report.reports[0].message.includes('trusted'))
  })

  it('should not return error for a struct', () => {
    const code = contractWith(`
  struct Token {
    address tokenAddress;
    string tokenSymbol;
  }

  mapping(address => Token) public acceptedTokens;

  function b(address tokenAddress, string memory tokenSymbol) public {
    Token memory token = Token(tokenAddress, tokenSymbol);
    acceptedTokens[tokenAddress] = token;
  }
    `)

    const report = linter.processStr(code, {
      rules: { 'mark-callable-contracts': 'warn' }
    })

    assert.equal(report.warningCount, 0)
  })
})

@@ -563,16 +563,612 @@
 )%0A  %7D)%0A%0A
+  it('should not return error for external contract that is marked as trusted', () =%3E %7B%0A    const code = funcWith('TrustedBank.withdraw(100);')%0A%0A    const report = linter.processStr(code, %7B%0A      rules: %7B 'mark-callable-contracts': 'warn' %7D%0A    %7D)%0A%0A    assert.equal(report.warningCount, 0)%0A  %7D)%0A%0A  it('should not return error for external contract that is marked as untrusted', () =%3E %7B%0A    const code = funcWith('UntrustedBank.withdraw(100);')%0A%0A    const report = linter.processStr(code, %7B%0A      rules: %7B 'mark-callable-contracts': 'warn' %7D%0A    %7D)%0A%0A    assert.equal(report.warningCount, 0)%0A  %7D)%0A%0A
   it('sh

Add more tests for mark-callable-contracts rule