[Gambas-user] Test Module, First try
Christof Thalhofer
chrisml at deganius.de
Sat Jul 18 13:13:12 CEST 2020
Am 18.07.20 um 11:19 schrieb Brian G:
> Hi I have attached a first try at using the test module to test the
> Scripter gbs3
>
> Maybe Christof could have a look at it and well
>
> Point out the error of my way!
I do not understand well. There are a couple of tests which report not
ok. I attach the TAP output I get here on my machine.
Some of them occur because I have another language than you. To see
that please have a look at the result of:
TbCommandLinePrograms:CreateProgramFromCommandLineArgs
If you have a problem with a specific test please tell me it's name.
Alles Gute
Christof Thalhofer
--
Dies ist keine Signatur
-------------- next part --------------
1..11
# Initialize the component collection
# When Gambas ide creates a library with no vendor using make executable then an (unknown) directory is created in the users .local library
# This differs from create installation which forces a vendor name before continuing
Test TaSetupForAllTests:SetupForTests
# This sets up env for all following tests
ok 1 - Used to force test setup
1..1
ok 1 - TaSetupForAllTests:SetupForTests
Test TbCommandLinePrograms:CreateProgramFromCommandLineArgs
not ok 1 - Test For bad Component
#
# ------------- Expected -------------
# gbs3: Dim i as integer:Print i:inc i.0: Unknown component: gb.inotifyt
#
# ---------------- Got ---------------
# gbs3: Dim i as integer:Print i:inc i.0: Unbekannte Komponente: gb.inotifyt
# ------------------------------------
#
# Compare size a=6, b=6
# 0001 = "Public.Sub.Main()" | "Public.Sub.Main()"
# 0002 = "Dim.i.As.Integer" | "Dim.i.As.Integer"
# 0003 = "i=9" | "i=9"
# 0004 = "Print.i" | "Print.i"
# 0005 = "inc.i" | "inc.i"
# 0006 = "End" | "End"
ok 2 - Verify program is formatted Correctly from command Line
1..2
not ok 2 - TbCommandLinePrograms:CreateProgramFromCommandLineArgs
Test TbCommandLinePrograms:ExecuteACommandLineProgram
# Application Output
# We say Hello World
# 0
# 1
# 2
#
ok 1 - Check the output from the Executed command line script
1..1
ok 3 - TbCommandLinePrograms:ExecuteACommandLineProgram
Test TbCommandLinePrograms:Precompile
# Testing PreCompile
ok 1 - Test precompile short forms I
ok 2 - Test precompile short forms F
ok 3 - Test precompile short forms L
not ok 4 - Test for error
#
# ------------- Expected -------------
# gbs3: {l}Acar=45.1: ReDefinition of variable Dim Acar As Long From Dim Acar As Integer Not Allowed
#
# ---------------- Got ---------------
# gbs3: {l}Acar=45.1: Neudefinition der Variablen Dim Acar As Long Von Dim Acar As Integer Nicht erlaubt
# ------------------------------------
#
1..4
not ok 4 - TbCommandLinePrograms:Precompile
Test TcMMainFunctions:CheckLibraryVersions
ok 1 - Veryify we can get the correct library n.n.x
ok 2 - Veryify we can get the correct library n.x.x
ok 3 - Veryify we can get the correct library n.n.n
ok 4 - Veryify we can get the correct library n.x.x
ok 5 - Veryify we can get the correct library x.x.x
ok 6 - Veryify we can get the correct library bad directory name
ok 7 - Veryify we can get the correct library Bad Lib Name
1..7
ok 5 - TcMMainFunctions:CheckLibraryVersions
Test TcMMainFunctions:CheckProcessLibrary
# Verify Library search and versioning
#
not ok 1 - Verify that error is generated when not found
#
# ------------- Expected -------------
# gbs3: ~/projects.1: Unknown Library: DummyLibName
#
# ---------------- Got ---------------
# gbs3: ~/projects.1: Unbekannte Bibliothek: DummyLibName
# ------------------------------------
#
ok 2 - Test for absolute path in library name
#
# You must have a directory called /usr/lib/gambas3/biz1 in your system for this test
# It must contain liba:1.1.0.gambas, liba:2.1.0.gambas, liba:3.1.3
# The tests will fail if not present, not a problem. You can copy and paste following into a terminal and try again
# sudo mkdir /usr/lib/gambas3/biz1
# sudo touch /usr/lib/gambas3/biz1/liba:1.1.0.gambas
# sudo touch /usr/lib/gambas3/biz1/liba:1.2.0.gambas
# sudo touch /usr/lib/gambas3/biz1/liba:2.1.0.gambas
# sudo touch /usr/lib/gambas3/biz1/liba:3.1.3.gambas
#
#
not ok 3 - TcMMainFunctions:CheckProcessLibrary crashed with error 'gbs3: ~/DummyProg.1: Unbekannte Bibliothek: biz1.liba:3.1'
1..3
not ok 6 - TcMMainFunctions:CheckProcessLibrary
Test TcMMainFunctions:Components
# Testing Needed Component
ok 1 - Check if form is correctly set on init
ok 2 - Forms need gui first
1..2
ok 7 - TcMMainFunctions:Components
Test TcMMainFunctions:FullReadCompileCheck
# Compare size a=32, b=32
# 0001 = "Class.Testit.Defined.{" | "Class.Testit.Defined.{"
# 0002 = "...public.a.as.integer" | "...public.a.as.integer"
# 0003 = "public.sub.GetA().as.integer" | "public.sub.GetA().as.integer"
# 0004 = "...return.a" | "...return.a"
# 0005 = "end" | "end"
# 0006 = "}" | "}"
# 0007 = "Project.file.{" | "Project.file.{"
# 0008 = "#.Gambas.Project.File.3.0" | "#.Gambas.Project.File.3.0"
# 0009 = "Title=Gambas.Script" | "Title=Gambas.Script"
# 0010 = "Startup=MMain" | "Startup=MMain"
# 0011 = "Component=gb.eval" | "Component=gb.eval"
# 0012 = "Component=gb.eval.highlight" | "Component=gb.eval.highlight"
# 0013 = "Component=gb.pcre" | "Component=gb.pcre"
# 0014 = "}" | "}"
# 0015 = "'.Gambas.module.file" | "'.Gambas.module.file"
# 0016 = "Public.x.as.string.=.\"hello\"" | "Public.x.as.string.=.\"hello\""
# 0017 = "public.struct.testStruct" | "public.struct.testStruct"
# 0018 = "....H.as.string." | "....H.as.string."
# 0019 = "....g.as.integer" | "....g.as.integer"
# 0020 = "....f.as.variant" | "....f.as.variant"
# 0021 = "end.struct" | "end.struct"
# 0022 = "public.sub.WriteSomething()" | "public.sub.WriteSomething()"
# 0023 = "..print.\"Write.Something\"" | "..print.\"Write.Something\""
# 0024 = "end" | "end"
# 0025 = "public.sub.MoreFunctions().as.string" | "public.sub.MoreFunctions().as.string"
# 0026 = "print.\"More.stuff.as.string\"" | "print.\"More.stuff.as.string\""
# 0027 = "end" | "end"
# 0028 = "Public.Sub.Main()" | "Public.Sub.Main()"
# 0029 = "for.i.as.integer.=.0.to.20" | "for.i.as.integer.=.0.to.20"
# 0030 = "...print.x;;i" | "...print.x;;i"
# 0031 = "next" | "next"
# 0032 = "End" | "End"
ok 1 - Test a Basic App with all supported types
1..1
ok 8 - TcMMainFunctions:FullReadCompileCheck
Test TcMMainFunctions:ValidFileRebuildCheck
# Testing If rebuild Of script required check
ok 1 - Check if rebuild required . not needed
ok 2 - Check if rebuild required . Needed
1..2
ok 9 - TcMMainFunctions:ValidFileRebuildCheck
Test TdMServerPages:RunWebPageGeneratedProgram
# Run the full web page generation and check we have valid output from the generated program
# Compare size a=12, b=12
# 0001 = "Content-type:.text/html;charset=utf-8 | "Content-type:.text/html;charset=utf-8
# 0002 = "Content-Length:.146\r" | "Content-Length:.146\r"
# 0003 = "\r" | "\r"
# 0004 = ".#!/bin/env./usr/bin/gbw3" | ".#!/bin/env./usr/bin/gbw3"
# 0005 = "........" | "........"
# 0006 = "........<html>" | "........<html>"
# 0007 = "........" | "........"
# 0008 = "........<h1>Gambas3.Web.Server.</h1>" | "........<h1>Gambas3.Web.Server.</h1>"
# 0009 = "........" | "........"
# 0010 = "........A01.ON\r" | "........A01.ON\r"
# 0011 = "........" | "........"
# 0012 = "........</html>" | "........</html>"
ok 1 - Verify That a correct Basic webpage is generated
#
1..1
ok 10 - TdMServerPages:RunWebPageGeneratedProgram
Test TdMServerPages:WebPageProgramCreation
# Generate the script to be executed from the web page
# Compare size a=12, b=12
# 0001 = "USE.\"gb.web\"" | "USE.\"gb.web\""
# 0002 = "PUBLIC.SUB.Main()" | "PUBLIC.SUB.Main()"
# 0003 = "..Response.Buffered.=.TRUE" | "..Response.Buffered.=.TRUE"
# 0004 = "..Response.Begin" | "..Response.Begin"
# 0005 = ".._PrintPage()" | ".._PrintPage()"
# 0006 = "..Response.End" | "..Response.End"
# 0007 = "END" | "END"
# 0008 = "PRIVATE.SUB._PrintPage()" | "PRIVATE.SUB._PrintPage()"
# 0009 = "PRINT.\".#!/bin/env./usr/bin/gbw3\\n. | "PRINT.\".#!/bin/env./usr/bin/gbw3\\n.
# 0010 = "print.\"A01.ON\"" | "print.\"A01.ON\""
# 0011 = "PRINT.\"\\n........\\n........</html> | "PRINT.\"\\n........\\n........</html>
# 0012 = "END" | "END"
ok 1 - Compile Web Page, test for correct source code output
1..1
ok 11 - TdMServerPages:WebPageProgramCreation
# Ausgeführt: 'TaSetupForAllTests.SetupForTests,TbCommandLinePrograms.CreateProgramFromCommandLineArgs;ExecuteACommandLineProgram;Precompile,TcMMainFunction
s.CheckLibraryVersions;CheckProcessLibrary;Components;FullReadCompileCheck;ValidFileRebuildCheck,TdMServerPages.RunWebPageGeneratedProgram;WebPageProgramCre
ation'
#
# 4 tests failed:
# 1: TbCommandLinePrograms:CreateProgramFromCommandLineArgs -- Test For bad Component
# 4: TbCommandLinePrograms:Precompile -- Test for error
# 1: TcMMainFunctions:CheckProcessLibrary -- Verify that error is generated when not found
# 3: TcMMainFunctions:CheckProcessLibrary -- TcMMainFunctions:CheckProcessLibrary crashed with error 'gbs3: ~/DummyProg.1: Unbekannte Bibliothek: biz1.liba:
3.1'
#
# FAILED
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200718/77667c8a/attachment-0001.sig>
More information about the User
mailing list