Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] unit tests? how or where are those with eclipse plugins dev.?

yeah i know.

But for now i just added all the string or number methods also for the most part
so they are also tested.

Currently very busy upgrading the parser to the latest Rhino 1.6 release because i think it was a quite older variant.
Because it seems not to like some _javascript_ constructs (in xml) that should be valid.

But there where quite some changes made to the rhino parser that i also have to apply to the new 1.6R7 variant.

But happily there are unit test that now fail :)

johan


On Wed, Sep 17, 2008 at 4:00 PM, Alex Panchenko <alex@xxxxxxxxx> wrote:
Hi Johan,

IMHO in this example we should test that there is "world" in the list of the completions, other items should be ignored.

The methods of the String/Number should be tested by other test cases.

Regards,
Alex

PS. new Object() way could be working now, but it will stop working when you add toString() method for the Object class :-)



Johan Compagner wrote:
hmm :)

Many things go wrong now because we test this:

var firstVar= "1";
var secondVar= "2";
firstVar.world= "3";
firstVar.

and then we test what the code completion gives us after the dot
That was always just 1 word:  "world" but now it is at least 30+ entries more...
All the functions that also a String js object has (like substring/concat and so on)

Same for integer and so on. those have now toPrecision() and toFixed()

So the question is what are we really testing? that world is added to a js object
or that world is added to a String js object? Else i can just make it all like this:

var firstVar= new Object();
var secondVar= new Object();
firstVar.world= new Object();
firstVar.


and then the test works again
And add a few test that does test really for String and Integer..

johan

On Mon, Sep 15, 2008 at 2:00 PM, Alex Panchenko <alex@xxxxxxxxx <mailto:alex@xxxxxxxxx>> wrote:

   Hi Johan,

   Unit tests are usually created in the separate plugin/fragment
   projects - the tests are usually splitted into multiple projects
   to control dependencies.

   In DLTK the tests projects are committed to the tests/ subfolder
   under the language component, e.g.
   org.eclipse.dltk/_javascript_/tests. There is a single
   org.eclipse.dltk._javascript_.core.tests project with _javascript_
   tests at the moment.

   In the tests project there is AllTests class to create suites for
   all of the tests.

   You can add your tests to the existing project or create a new one
   if needed. If you are creating a new project - please post the
   details so we will add it to the build system, etc.

   To launch the tests you should right click the AllTests class
   and Run as -> JUnit plugin test.

   Btw, the current _javascript_ completion tests started failing on
   the last week - would you please look into?

   Regards,
   Alex

   Johan Compagner wrote:

       Hi,

       last week i had to implement a algorithm that was a perfect
       candidate to first make a unit test
       and based on that make the real code

       Now i was wondering if i could also check that unit test in
       somewhere?
       i created quickly a src-test dir in the plugins project but
       how is this done in eclipse ?
       is there some kind of standard?

       the unit test i had:

          public void testIdResolving() throws Exception {

              assertEquals("forms.xxx.yyy",
       HostCollection.parseId("forms.xxx.yyy"));
              assertEquals("forms.xxx.yyy",
       HostCollection.parseId("forms.xxx.yyy()"));
              assertEquals("forms.xxx.yyy", HostCollection
                      .parseId("forms.xxx().yyy()"));
              assertEquals("forms.xxx.[].yyy.[]", HostCollection
                      .parseId("forms.xxx[].yyy[]"));
              assertEquals("forms.[].yyy",
       HostCollection.parseId("forms[xxx].yyy"));
              assertEquals("forms.[].yyy",
       HostCollection.parseId("forms[xxx()].yyy"));
              assertEquals("forms.[].yyy", HostCollection
                      .parseId("forms[xxx(1)].yyy"));
              assertEquals("xxx", HostCollection.parseId("forms[xxx"));
              assertEquals("", HostCollection.parseId("forms[xxx("));
              assertEquals("a", HostCollection.parseId("forms[xxx(a"));
              assertEquals("xxx",
       HostCollection.parseId("forms[xxx(1)"));
              assertEquals("xxx.yyy",
       HostCollection.parseId("forms[xxx(1).yyy"));
              assertEquals("forms.[]",
       HostCollection.parseId("forms[xxx(1).yyy]"));

              assertEquals("forms.[]",
       HostCollection.parseId("forms[xxx(1).yyy]]"));
              assertEquals("forms.[]",
       HostCollection.parseId("forms[xxx(1)).yyy]"));
              assertEquals("forms.[]",
       HostCollection.parseId(")forms[xxx(1)).yyy]"));

          }


       ------------------------------------------------------------------------

       _______________________________________________
       dltk-dev mailing list
       dltk-dev@xxxxxxxxxxx <mailto:dltk-dev@xxxxxxxxxxx>

       https://dev.eclipse.org/mailman/listinfo/dltk-dev

   _______________________________________________
   dltk-dev mailing list
   dltk-dev@xxxxxxxxxxx <mailto:dltk-dev@xxxxxxxxxxx>

   https://dev.eclipse.org/mailman/listinfo/dltk-dev


------------------------------------------------------------------------

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev
 
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev


Back to the top