tests: Updated to fit new API.
authorLucas Bajolet <r4pass@hotmail.com>
Mon, 23 Jun 2014 13:50:40 +0000 (09:50 -0400)
committerLucas Bajolet <r4pass@hotmail.com>
Mon, 23 Jun 2014 15:01:12 +0000 (11:01 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

tests/sav/test_text.res
tests/sav/test_text_alt1.res
tests/sav/test_text_alt2.res
tests/sav/test_to_upper_lower_buffer.res [moved from tests/sav/test_to_upper_lower_alt1.res with 100% similarity]
tests/test_flatrope.nit
tests/test_hash_text.nit
tests/test_ropes.nit
tests/test_text.nit
tests/test_to_upper_lower.nit
tests/test_to_upper_lower_buffer.nit [new file with mode: 0644]

index fc9283b..9a83175 100644 (file)
@@ -1,8 +1,5 @@
-WOE TO YOU, OH EARTH AND SEA FOR THE DEVIL SENDS THE BEAST WITH WRATH BECAUSE HE KNOWS THE TIME IS SHORT. LET HIM WHO HATH UNDERSTANDING RECKON THE NUMBER OF THE BEAST, FOR IT IS A HUMAN NUMBER, ITS NUMBER IS SIX HUNDRED AND SIXTY-SIX.
-woe to you, oh earth and sea for the devil sends the beast with wrath because he knows the time is short. let him who hath understanding reckon the number of the beast, for it is a human number, its number is six hundred and sixty-six.
 Woe to you, oh earth and sea for the Devil sends the beast with wrath because he knows the time is short.
 Let him who hath understanding reckon the number of the beast, for it is a human number, its number is Six Hundred and Sixty-Six.
-.xiS-ytxiS dna derdnuH xiS si rebmun sti ,rebmun namuh a si ti rof ,tsaeb eht fo rebmun eht nokcer gnidnatsrednu htah ohw mih teL .trohs si emit eht swonk eh esuaceb htarw htiw tsaeb eht sdnes liveD eht rof aes dna htrae ho ,uoy ot eoW
 235
 13
 110
index fc9283b..9a83175 100644 (file)
@@ -1,8 +1,5 @@
-WOE TO YOU, OH EARTH AND SEA FOR THE DEVIL SENDS THE BEAST WITH WRATH BECAUSE HE KNOWS THE TIME IS SHORT. LET HIM WHO HATH UNDERSTANDING RECKON THE NUMBER OF THE BEAST, FOR IT IS A HUMAN NUMBER, ITS NUMBER IS SIX HUNDRED AND SIXTY-SIX.
-woe to you, oh earth and sea for the devil sends the beast with wrath because he knows the time is short. let him who hath understanding reckon the number of the beast, for it is a human number, its number is six hundred and sixty-six.
 Woe to you, oh earth and sea for the Devil sends the beast with wrath because he knows the time is short.
 Let him who hath understanding reckon the number of the beast, for it is a human number, its number is Six Hundred and Sixty-Six.
-.xiS-ytxiS dna derdnuH xiS si rebmun sti ,rebmun namuh a si ti rof ,tsaeb eht fo rebmun eht nokcer gnidnatsrednu htah ohw mih teL .trohs si emit eht swonk eh esuaceb htarw htiw tsaeb eht sdnes liveD eht rof aes dna htrae ho ,uoy ot eoW
 235
 13
 110
index fc9283b..9a83175 100644 (file)
@@ -1,8 +1,5 @@
-WOE TO YOU, OH EARTH AND SEA FOR THE DEVIL SENDS THE BEAST WITH WRATH BECAUSE HE KNOWS THE TIME IS SHORT. LET HIM WHO HATH UNDERSTANDING RECKON THE NUMBER OF THE BEAST, FOR IT IS A HUMAN NUMBER, ITS NUMBER IS SIX HUNDRED AND SIXTY-SIX.
-woe to you, oh earth and sea for the devil sends the beast with wrath because he knows the time is short. let him who hath understanding reckon the number of the beast, for it is a human number, its number is six hundred and sixty-six.
 Woe to you, oh earth and sea for the Devil sends the beast with wrath because he knows the time is short.
 Let him who hath understanding reckon the number of the beast, for it is a human number, its number is Six Hundred and Sixty-Six.
-.xiS-ytxiS dna derdnuH xiS si rebmun sti ,rebmun namuh a si ti rof ,tsaeb eht fo rebmun eht nokcer gnidnatsrednu htah ohw mih teL .trohs si emit eht swonk eh esuaceb htarw htiw tsaeb eht sdnes liveD eht rof aes dna htrae ho ,uoy ot eoW
 235
 13
 110
index 79b719f..09644ca 100644 (file)
@@ -16,7 +16,7 @@ var st = "quick brown fox over the lazy dog"
 
 print st
 
-var pr = st.prepend("The ")
+var pr = "The " + st
 
 print pr
 
@@ -24,8 +24,8 @@ pr = st.insert_at(" jumps", 15)
 
 print pr
 
-pr = st.append(".")
+pr = st + "."
 
 print pr
 
-print st.insert_at(" jumps", 15). prepend("The ").append(".")
+print "The " + st.insert_at(" jumps", 15) + "."
index e655dd8..39d0f48 100644 (file)
@@ -16,7 +16,11 @@ var x = "string__NativeString__to_s_with_length"
 
 var y = "string" + "__" + "NativeString" + "__" + "to_s_with_length"
 
-var z = new FlatBuffer.from("string") + "__" + "NativeString" + "__" + "to_s_with_length"
+var z = new FlatBuffer.from("string")
+z.append("__")
+z.append("NativeString")
+z.append("__")
+z.append("to_s_with_length")
 
 var a = ["string", "NativeString", "to_s_with_length"].join("__")
 
index 3040d12..87b0e9a 100644 (file)
@@ -64,12 +64,11 @@ print ss
 
 var atb = new Array[String]
 
-var s = new RopeString
-s = s.prepend(".types").as(RopeString)
-s = s.prepend("./examples/hello_world.nit".substring(11,11)).as(RopeString)
-s = s.append(".").as(RopeString)
-s = s.append("1").as(RopeString)
-s = s.append(".o").as(RopeString)
+var s: String = new RopeString
+s = s + "./examples/hello_world.nit".substring(11,11) + ".types"
+s += "."
+s += "1"
+s += ".o"
 
 print s
 
index 4a27158..9357645 100644 (file)
@@ -38,12 +38,8 @@ num = numstr
 
 # Test Text methods on all types of receivers
 
-print txt.to_upper
-print txt.to_lower
-assert txt * 2 == txt + txt
 print txt.substring(0, 105)
 print txt.substring_from(106)
-print txt.reversed
 print txt.length
 assert not txt.is_empty
 print txt.index_of('h')
@@ -65,7 +61,6 @@ assert txt.hash == trimable.trim.hash
 var chars = txt.chars
 
 assert chars != txt.substring_from(106).chars
-assert (txt.substring(0,105) + txt.substring_from(105)).chars == txt.chars
 assert chars[0] == 'W'
 assert chars.count('o') == 11
 assert chars.first == chars[0]
index 4a237ef..368a658 100644 (file)
@@ -18,9 +18,6 @@ var y: Text
 x = "test"
 y = "TEST"
 
-#alt1 x = new FlatBuffer.from("test")
-#alt1 y = new FlatBuffer.from("TEST")
-
 assert x.to_upper == y
 assert y.to_lower == x
 
diff --git a/tests/test_to_upper_lower_buffer.nit b/tests/test_to_upper_lower_buffer.nit
new file mode 100644 (file)
index 0000000..d8b7eb5
--- /dev/null
@@ -0,0 +1,23 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var x = new FlatBuffer.from("test")
+var y = new FlatBuffer.from("TEST")
+
+x.upper
+y.lower
+
+assert x == "TEST"
+assert y == "test"
+