Skip to content
This repository has been archived by the owner on May 31, 2020. It is now read-only.

Implement builtin float method #55

Merged
merged 3 commits into from
May 9, 2016
Merged

Conversation

pietertolsma
Copy link
Contributor

@pietertolsma pietertolsma commented May 7, 2016

Implemented the float method. Part of ticket #47 . Also add env to .gitignore.

Disclaimer: this is my first time contributing to an open-source project.

@pietertolsma pietertolsma reopened this May 7, 2016
@pietertolsma
Copy link
Contributor Author

Somehow it is not passing the tests. Can't find variable; batavia. I don't see how my changes affected this?

@jdorfman
Copy link

jdorfman commented May 7, 2016

@freakboy3742 any chance you can check this out for @pietertolsma and possibly point him the right direction? Thanks!

@freakboy3742
Copy link
Member

@pietertolsma Thanks for the patch! The failure is an odd one - it looks like it's a system-wide failure caused by the minified Batavia script not being compiled.

Can you confirm that you've been able to run the test suite locally, and if so - on what platform? Can you also provide the output of pip freeze, and the version of PhantomJS that you're using in your local testing.

@pietertolsma
Copy link
Contributor Author

@freakboy3742 Weird, my local test suite is giving the same results as Travis CI (I'm running OS X El Capitan).

pip freeze gives me:
-e git+https://github.com/pietertolsma/batavia.git@ffa87affce7eee25cff416d55c1399cadfa8b72b#egg=batavia jsmin==2.2.1

I'm using version 2.1.1 of PhantomJS.

@pietertolsma
Copy link
Contributor Author

Wow. Just noticed what's wrong. Syntax error (typo) in the method. Uploading fix now.


var toConvert = args[0];

if(typeof(toConvert)) === "string"){
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here

@pietertolsma
Copy link
Contributor Author

So no failures this time, but an unexpected success. Do I need to edit a test case?

@freakboy3742
Copy link
Member

@pietertolsma Yes - the "unexpected success" indicates a test that now passes, whereas previously it didn't. It's entirely possible (and probable) that by fixing one specific operator, a couple of other tests now pass as well. For example, if you implement the "+" operator, "+=" will probably also start working, because the implementation of "+=" falls back on "+" by default.

When you run the test suite, it will tell you the name of the test (or tests) that are now passing. Find the test file (tests/datatypes/...) that corresponds to the unexpected success. In that file, you'll find test cases, each of which have a "not implemented" list. This details the tests that are known to pass because the underlying operator isn't implemented. Remove the lines from that list that correspond to the unexpected success, save, and re-run the test suite. You should now get a test suite that passes with no failures, and no unexpected successes. Commit and push, and the CI server should re-run the test suite for you; once that is confirmed, I can merge the patch!

One other request if you get a chance: we prefer to have spaces around if clauses - i.e.

if (x > y) {
   ...
} else if (x < z) {
  ...
} else {
   ...
}

It's a little thing, but keeping the code style consistent aids readability in the long term.

@pietertolsma
Copy link
Contributor Author

Cheers! @freakboy3742 thank you for all the help! Hope to contribute more to this project as time passes 👍

@freakboy3742 freakboy3742 merged commit f270b51 into beeware:master May 9, 2016
@freakboy3742
Copy link
Member

Fantastic! Thanks Pieter - I look forward to seeing your next contribution!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants