Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-07-2007, 07:59 PM
Zimlet Guru & Moderator
 
Posts: 467
Default Project Management, Testing and basic Javascript questions

I have been working on a time management system that is modeled on tasks (things to do, and how long they took to do) and contexts (tasks depend on other tasks, and tasks should be recorded for billing purposes).

As part of this, I wrote a real quick and dirty unit testing (and hopefully functional testing as well) zimlet that I can use to plan out code, and to test my code base.



Right now to run each test, I have a lot of code that reads:
Code:
TestController.startTest(this, this.taskCreate);
Which obviously, I would like to automate. Is there any way to programmaticly reflect/introspect in javascript to look for methods that match a particular name (starts with test, one format param?)
Reply With Quote
  #2 (permalink)  
Old 01-07-2007, 09:12 PM
Project Contributor
 
Posts: 252
Default

I don't understand you much but a for...in loop through the object class may work.

Code:
var res = [];
for(var i in this){
if(typeof(this[i]) == "function" && !i.indexOf("test")){
res.push(i);
}
}
alert(res.join("\n"));
Yeeha! Feels nice to post code

Fernando
Reply With Quote
  #3 (permalink)  
Old 01-08-2007, 03:30 PM
Zimlet Guru & Moderator
 
Posts: 467
Default

Quote:
Originally Posted by __proto__ View Post
I don't understand you much but a for...in loop through the object class may work.

Code:
var res = [];
for(var i in this){
if(typeof(this[i]) == "function" && !i.indexOf("test")){
res.push(i);
}
}
alert(res.join("\n"));
Yeeha! Feels nice to post code

Fernando
That works like a champ! Thank you!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.