Jump to content

Module:Stock tickers/NYSE/testcases: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
another example
add tests cases for different exchanges
Line 5: Line 5:
self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | PRE.PRD}}', 'http://www.nyse.com/quote/XNYS:PREpD')
self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | PRE.PRD}}', 'http://www.nyse.com/quote/XNYS:PREpD')
self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | BCS.PR}}', 'http://www.nyse.com/quote/XNYS:BCSp')
self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | BCS.PR}}', 'http://www.nyse.com/quote/XNYS:BCSp')
end

function p:test_exchanges()
self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | GE }}', 'http://www.nyse.com/quote/XNYS:GE')
self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | GE | exchange=NYSE}}', 'http://www.nyse.com/quote/XNYS:GE')
self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | BTI | exchange=AMEX}}', 'http://www.nyse.com/quote/XASE:BTI')
self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | SPY | exchange=ARCA}}', 'http://www.nyse.com/quote/ARCX:SPY')
end
end



Revision as of 13:51, 3 August 2014

-- Example Unit tests for [[Module:Stock tickers/NYSE]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_preferred_shares()
    self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | PRE.PRD}}', 'http://www.nyse.com/quote/XNYS:PREpD')
    self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | BCS.PR}}', 'http://www.nyse.com/quote/XNYS:BCSp')
end

function p:test_exchanges()
    self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | GE }}', 'http://www.nyse.com/quote/XNYS:GE')
    self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | GE | exchange=NYSE}}', 'http://www.nyse.com/quote/XNYS:GE')
    self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | BTI | exchange=AMEX}}', 'http://www.nyse.com/quote/XASE:BTI')
    self:preprocess_equals('{{#invoke:Stock tickers/NYSE | GetURL | SPY | exchange=ARCA}}', 'http://www.nyse.com/quote/ARCX:SPY')
end

return p