I'm reading truffles's docs and am trying to build a custom project with a contract and a few test cases (written in a js file). I need to do this because testrpc is (considerably) faster than geth. My setup is as follows:
I have a directory for the project with the following layout:
drwxr-xr-x 5 user user 4096 Aug 4 10:55 app
drwxr-xr-x 4 user user 4096 Aug 4 11:35 build
drwxr-xr-x 2 user user 4096 Aug 4 11:06 contracts
drwxr-xr-x 2 user user 4096 Aug 4 10:55 migrations
drwxr-xr-x 2 user user 4096 Aug 4 11:24 test
-rw-r--r-- 1 user user 248 Aug 4 10:55 truffle.js
The files were created using truffle init
. I've cleared the contracts in the contracts
directory and the js files in the test
directory.
I have a contract:
C.sol
contract C {
string words = "Bla bla bla";
uint256 lastVal;
function math(uint256 a, uint256 b) returns (uint256) {
lastVal = a + b;
return lastVal;
}
function getWords() constant returns (string) {
return words;
}
}
in the contracts
directory and a test file:
c.js
contract('C', function(accounts) {
it("Getting the words string from the contract", function() {
var c = C.deployed();
return c.getWords.call(accounts[0]).then(function(words) {
assert.equal(words, "Bla bla bla", "[E] The contract should have said \"Bla bla bla\"");
});
});
it(" 2 + 2 = 4 ", function(){
var c = C.deployed();
return c.math(2, 2).then(function(additionResult){
assert.equal(additionResult, 4, "[E] 2 + 2 = 4 even in eth. contracts.");
});
});
});
in the tests
directory. I have manually cleared the build
directory and ran
truffle build
int the base directory. Nothing (no artifacts) gets built in the build
directory. Why?
Does anybody have a minimal setup that does not involve developing a web app? only the contract .sol files and js test files.