File indexing completed on 2024-04-21 03:45:23

0001 #  SPDX-FileCopyrightText: 2009 Cies Breijs
0002 #
0003 #  SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 require File.dirname(__FILE__) + '/spec_helper.rb'
0006 $i = Interpreter.instance
0007 
0008 describe "assert statement" do
0009 
0010   it "should pass when evaluating true" do
0011     $i.should_run_clean 'assert true'
0012   end
0013 
0014   it "should fail when evaluating false" do
0015     $i.run('assert false').errors?.should be_true
0016   end
0017 
0018   it "should not take anything but a boolean argument" do
0019     $i.run('assert 123').errors?.should be_true
0020     $i.run('assert 1.23').errors?.should be_true
0021     $i.run('assert "qwe"').errors?.should be_true
0022   end
0023 
0024   it "should take exactly one argument" do
0025     $i.run('assert').errors?.should be_true
0026     $i.run('assert true, true').errors?.should be_true
0027   end
0028 
0029 end