Warning, file /education/kturtle/spec/string_spec.rb was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 # SPDX-FileCopyrightText: 2009 Cies Breijs 0002 # SPDX-FileCopyrightText: 2009 Niels Slot 0003 # 0004 # SPDX-License-Identifier: GPL-2.0-or-later 0005 0006 require File.dirname(__FILE__) + '/spec_helper.rb' 0007 $i = Interpreter.instance 0008 0009 describe "string" do 0010 it "should work as expected with simple strings" do 0011 $i.should_run_clean <<-EOS 0012 $x = "test" 0013 $y = "kturtle" 0014 assert $x == "test" 0015 assert $y == "kturtle" 0016 0017 $cies = "Cies" 0018 $author = "Cies" 0019 assert $cies == $author 0020 EOS 0021 end 0022 0023 it "should work as expected with unicode characters" 0024 0025 it "should work as expected with escaped quotes" do 0026 $i.should_run_clean <<-EOS 0027 $x = "\\"quote" 0028 $y = "\\"quotes\\"" 0029 0030 # We currently have no way to validate if the string 0031 # was correctly parsed by KTurtle. e.g. printing a 0032 # string with quotes also prints the slashes. 0033 0034 assert false 0035 EOS 0036 end 0037 0038 it "should allow string concatenation" do 0039 $i.should_run_clean <<-EOS 0040 $x = "K" 0041 $y = "Turtle" 0042 $z = $x + $y 0043 assert $z == "KTurtle" 0044 0045 $first = "Cies" 0046 $last = "Breijs" 0047 $name = $first + " " + $last 0048 assert $name == "Cies Breijs" 0049 EOS 0050 end 0051 0052 it "should produce an error when not properly terminated" do 0053 $i.run("\"test").errors?.should be_true 0054 end 0055 end