Code Monkey home page Code Monkey logo

brstest's Introduction

Install Jekyll

bundle install --path vendor/bundle

Running Locally

bundle exec jekyll serve

Then open here

brstest's People

Contributors

cwright017 avatar greeneca avatar jlourenc avatar markroddy avatar moinahmed001 avatar thesmaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

brstest's Issues

proposal: add a `btmark()` function to help emulate stack traces.

Create a global method with signature btmark(message as String) that pushes each new message to a global stack variable. The global stack variable should be reset before running each test. Upon test failure (including errors, etc) print the contents of the stack. This could be used in both production and test code as follows:

Function something(input)
  btmark("starting something")
  ' do stuff
  btmark("something started")
  ' do more stuff
  '... etc
End Function

Function test_something(t as Object)
  btmark("testing something")
  something(generateSomeInput())
End Function

Done correctly calls to btmark could also replace some comment documentation, alleviate some of the pain caused by Brightscripts lack of a stack trace, and serve as an alternative to littering your code with print statements you intend to remove later. By only printing the message stack on test failure, your test output is not filled with irrelevant output. It would be fairly trivial to strip calls to btmark() from production code using a regexp.

License

Hello,

I am using your test framework in a app and the legal team wants to know how it is licensed. I noticed that you haven't stated a license anywhere. Can you add one? MIT is a good simple one that will protect you. (http://opensource.org/licenses/MIT) Thanks,

plugin architecture for additional assertions

allow users to create reusable assertions by calls to some global method

addAssertion("assertIsAwesome", function(args): ... : end function )

This would populate some global associative array with methods that would get copied to each new t parameter passed to test. It should fail if users are accidentally overriding an existing method (maybe an optional force parameter to allow overriding?). It would also require some documentation on how to correctly fail an assertion so behavior remains consistent with other methods.

assertEqual fails for cyclic AAs

Since AAs are stored internally as pointers, they can contain references to themselves without requiring infinite memory. However, the current method of checking equality (check each k/v pair for equality, recursing if the value is also an AA) will enter an infinite loop.

Although this might sound like an awkward edge case, it's actually very common with the introduction of Scene Graph. All Scene Graph nodes implement ifArray (meaning they will be tested and prone to the same failure case as regular AAs). They also all have a focusedChild field, which -- while intended to be an internal field used for triggering observer callbacks only -- is freely readable, and nodes with focus have this field set to themselves.

Sample test cases:

sub testSameCyclicAA(t as object)
   x = {}
   x["key"] = x
   t.assertEqual(x,x)
end sub

sub testDifferentCyclicAAs(t as object)
   x = {}
   y = {}
   x["key"] = y
   y["key"] = x
   t.assertEqual(x,y)
end sub

Telnet output:

ERROR: testSameCyclicAA
----------------------------------------------------------------------
Unknown Error:  223

======================================================================
pkg:/source/examples/test_examples.brs
ERROR: testDifferentCyclicAAs
----------------------------------------------------------------------
Unknown Error:  223

add optional message parameter to assertion methods

For example: If I'm using t.assertTrue(...) multiple times in the same test, I currently have no way of knowing which of those assertions failed. An expanded syntax of:

t.assertTrue(value, message="" as String)

would allow for easy differentiation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.